I have encountered a problem with passing data from another activity to the current one. Actually, I have asked another question regarding the same issue here and now the problem is that the textView for the date become empty and I don’t know what’s wrong. Anyone could help me with this problem? Thanks a lot and I will really appreciate any help that I can get.
UPDATED:
Bundle bundle = getIntent().getExtras();
if(bundle != null)
{
String date = bundle.getString("date");
txtDate.setText(date);
}
when I run this, the textView won’t show anything. Can anyone help me? Thanks again.
String date = bundle.getString(“date”);
check whether the “date” that you are using as a key here in getString() is same to what you are using when you send the value from the previous activity.. for e.g,
Previous Activity = i.putExtra(“date”,”_yourvalue”);
Next Activity = Bundle bundle = getIntent().getExtras();
String date = bundle.getString(“date”);
If that is same then check whether you have initialised your textview properly using the following,
TextView tv = (TextView)findViewbyID(R.id.yourID);
then do
tv.setText(date);
And all of this must be done in the onCreate of the activity….
Let me know if the problem still persists..