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?
Asked
Active
Viewed 4,939 times
2 Answers
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
-
thnks! & wht should i do to take the values in the next activity? – user2490231 Jun 16 '13 at 07:07
-
@user2490231 Google? – Simon Jun 16 '13 at 07:11
-
1`String array[] = getIntent().getExtras().getStringArray("key");` – mihirjoshi Jun 16 '13 at 07:17
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