-5

im follow this post to pass arraylist as parameter to another screen from here Passing a List from one Activity to another now i want to save arraylist in string after get what do i do???

String myvalue; Activity A :

 ArrayList<String> list = new ArrayList<String>();


   intent.putExtra("arraylist", list);
   startActivity(intent);

   Activity B:

 ArrayList<String> list = getIntent().getSerializableExtra("arraylist");



        how to save list in  myvalue;
        like   myvalue=list;
Community
  • 1
  • 1
user2867267
  • 27
  • 3
  • 8

2 Answers2

0
Intent intent = new Intent(this, YOUR_CLASS.class);
intent.putExtra("string", list.get(0));
startActivity(intent);

in your another activity:

String str = getIntent().getStringExtra("string");
WOLVERINE
  • 769
  • 3
  • 12
  • 28
0

In FirstActivity:

Intent intent = new Intent(this, target.class);
intent.putStringArrayListExtra("name", stringarraysdb);
startActivity(intent);

In secondActivity:

Intent i=getIntent();
ArrayList ringarraysdb=i.getIntegerArrayListExtra("name");
laalto
  • 150,114
  • 66
  • 286
  • 303
Ramakrishna
  • 26
  • 1
  • 6