Hi,I am trying to pass two variables from one screen (ContactsView.java )to
second screen (NewContact.java)
In ContactsView.java I am passing two values as shown below:
static final String CONTACT_NAME = null;
static final String CONTACT_PHONENUMBER = null;
Intent intent = new Intent(this,NewContact.class);
String strName = "NAME";
String strPhoneNumber = "PHONENUMBER";
intent.putExtra(CONTACT_PHONENUMBER, strPhoneNumber);
intent.putExtra(CONTACT_NAME, strName);
startActivity(intent);
In NewContact.java I am receiving the values as shown below:
Bundle extras = getIntent().getExtras();
if(extras != null){
contactName = extras.getString(ContactsView.CONTACT_NAME);
contactPhoneNumber = extras.getString(ContactsView.CONTACT_PHONENUMBER);
System.out.println("----------- Name is -->"+ contactName);
System.out.println("----------- PhoneNumber is -->"+ contactPhoneNumber );
}
But at the println statements i am seeing
----------- Name is --> NAME
---------- PhoneNumber is --> NAME
What i observed is : The last putExtra is stored in all the variables. (i.e)
If i use intent.putExtra(CONTACT_PHONENUMBER, strPhoneNumber) as the last
statement. Then all the variables are having the values of phone number.
Can any one please help me out in passing the values from one screen to
another screen.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---