Dan Brian Arenas Dan Brian Arenas - 23 days ago 5x
Android Question

Passing bidimensional String Array variable from 1 activity to another

I have a bidimensional String array that has mass data (sizes are

to be exact) in my Activity A. I want to pass the whole array to Activity B. I've tried this solution: Passing string array between android activities

but the problem is it is creating an array inside. I want to pass my original bidimensional array that contains
values. Can I do that?


my String array is a 2 dimensional array.


Since your array is bidimensional and bidimensional array are serializable, you can use a bundle:

Intent intent = new Intent(this, activityB.class);
Bundle bundle = new Bundle();
bundle.putSerializable("myArray", myBidimensionalArray);

and in activityB you can simply call:

Intent passed = getIntent();
Bundle bundle = passed.getExtras();
String[][] myPassedArray = (String[][]) bindle.getSerializable("myArray");

and you are done