-1

I am having two activities in my application. I want to pass tha array of String from one activity to another.. How to pass this values from activity to activity?

user2490231
  • 9
  • 1
  • 3

2 Answers2

2
Bundle bundel = new Bundle();
bundel.putStringArray("key",array);

Intent intent = new Intent(this,next.class)
intent.putExtras(bundel);
startActivity(intent);
mihirjoshi
  • 12,161
  • 7
  • 47
  • 78
0

First activity:

ArrayList<String> array = new ArrayList<String>();
Intent intent = new Intent(this, nextActivity.class);
intent.putStringArrayListExtra("strings", array);
startActivity(intent);

Second activity:

ArrayList<String> resultArray = getIntent().getStringArrayListExtra("strings");
Dimmerg
  • 2,113
  • 1
  • 13
  • 14