1

I have a bidimensional String array that has mass data (sizes are [40][8] 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 [40][8] values. Can I do that?

EDIT:

my String array is a 2 dimensional array.

Community
  • 1
  • 1
Dan Arenas
  • 19
  • 1
  • 6

1 Answers1

1

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);
intent.putExtras(bundle);

and in activityB you can simply call:

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

and you are done

Pier Giorgio Misley
  • 5,305
  • 4
  • 27
  • 66