Question Detail

How to send array value from one activity to another Activity in android?

6 years ago Views 1466 Visit Post Reply

Hello All,
I have a String Array on an Activity and I want to pass it to next one. I can send String one activity to another by Stuck with Array.
How can I pass array one activity to another activity?Image result for one activity to another


Thread Reply

Anonymous

- 6 years ago

In the first activity:

Intent intent = new Intent(context, NewActivity.class);
intent.putExtra("key", stringArray);
context.startActivity(intent);

 

and in the second one:

Intent intent = getIntent();
String [] stringArray = intent.getStringArrayExtra("key");

Anonymous

- 6 years ago

http://recoverperu.org