How to pass Collections like ArrayList
, etc from one Activity
to another as we used to pass Strings
, int
with help of put
I tried all the proposed techniques but none of them worked and stopped my app from working and then I finally succedded. Here is how I did it... In main activity I did this:
List myList...;
Intent intent = new Intent...;
Bundle b=new Bundle();
b.putStringArrayList("KEY",(ArrayList)myList);
intent_deviceList.putExtras(b);
....startActivity(intent);
To get the data in the new Activity:
List myList...
Bundle b = getIntent().getExtras();
if (b != null) {
myList = bundle.getStringArrayList("KEY");
}
I hope this will help someone...