I want to send String
and List<String>
from one activity to another activity using the following code in first activity:
Intent intent1=new Intent(Activity2);
Bundle b=new Bundle();
b.putStringArrayList("IDs", (ArrayList<String>) ids);
intent1.putExtra("message","IDs");
intent1.putExtras(b);
And I am accessing this content in second activity as follows:
Bundle b= intent.getExtras();
String str=b.getString("message");
ArrayList<String> list=b.getStringArrayList("IDs");
The problem is: I am getting str
as null
even though list
is getting correct values. Am I missing something in using the Bundle
?