views:

34

answers:

1

How can I pass a multidimensional array from one activity to another?

+2  A: 

You can create a Serializable class which wraps the two-dimensional array, and pass it using Intent.putExtra(String name, Serializable value)

codelark
I have to pass a 2-d string array. Can u please give some example of how to pass and retrieve the array using Intent.putExtra(String name, Serializable value)
Maya
Reuben Scratton
Of course, if you have thousands of strings this might be too slow. You could implement your own scheme to condense your array to a single String (e.g. joining the elements together with some character sequence that's guaranteed to not appear in the array content).
Reuben Scratton
If you're passing thousands of strings, using any of the persistance strategies and passing the id to retrieve them would be a less-crazy thing to do.
codelark