android - Call ACTION_VIEW intent from another activity -


My problem is very complex for me: /

I have a main activity like this:

  setContentView (R. layout.main_activity); (...) LinearLayout Main Lineout Outout; Main Linear Line = (Linear Loyalty) Find VVBIID (RID. Mainliner Layout); Last JSONObject user = json_user.getJSONObject (0); ContactListData contact list = new contact list (); ContactList.AffLayoutData (this, user, main lilayout);  

I want to increase the elements in the main_activity layout, through the ContactListData class, I want to use a specific class to do this because I have this contact inflation in the second part of my application Will have to reuse.

My ContactListData.java:

  Here the public class expands ContactListData activity {public void AfflayoutData (reference reference, JSONObject contact, LinearLayout mainLinearLayout) {try linearLayout ll; // & gt; Here, many layouts are loaded in the main layout: ll = (linear layout) View.inflate (references, R.layout.contact_detail_separateur_titre, null); (TextView) ll.findViewById (R.id.titre)) setText ("Téléphone"); // (...) blablabla // and there are buttons with OnClickListener:. (FrameLayout) ll.findViewById (R.id.primary_action_view_container)) setOnClickListener (mSMSActionClickListener); ((Frame layout) ll.findViewById (R.id.primary_action_view_container)) setTag (contact.getString ("phone")); // (...) blablabla // Finally, the last layout is inflated: mainLinearLayout.addView (ll); } Hold (JasonX Express E) {e.printStackTrace (); Logs. ("GEDA Jason Exxption", blank); }} / ** My onClickListener * / Protected Last OnClickListener of the last button mSMSActionClickListener = New OnClickListener () {@Override Public Zero onClick (see v) {intent = new intent (Intent.ACTION_VIEW, Uri.fromParts ("SMS",) V.getTag (.) ToString (), Faucet)); StartActivity; }};  

Everyone is blown correctly but when I click on a button, I get this error:

04-28 23 Exception exception (group = 0x41bd3700) 04-28 23: 37: 51.934: E / AndroidRuntime (30,918): Severe Exception: Main 04-: Excess Exception Without Tired: 37: 51.934: W / Dalevicum (30 9 18) 28 23: 37: 51.934: E / AndroidRuntime (30,918): java.lang.NullPointerException 04-28 23:37: 51.934: E / AndroidRuntime (30,918): android.content.ContextWrapper.getApplicationContext (ContextWrapper.java:109) 04-28 23: 37: 51.934: E / AndroidRuntime (30,918): biz.jchambon.gedm.ContactListData $ 5.onClick (ContactListData.java:302)

I succeeded Without security (stationary / non-stationary problem ...), have attempted to start Intent.ACTION_VIEW parent activity. Who can help me?

The problem may be that v.getTag () Null To get the tag object, the view must already be stored by an object. To see Tags

R.id.primary_action_view_container , you set onClick listener while viewing your code, but tags for the scene.

You should have an object saved as tag for any view

  view.setTag (yourObject);  

So, you can get an object like this

  object object = view.getTag ();  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -