I have this arrayList: public ArrayList<ArrayList<String>> ejemplo=new ArrayList<>();
and I´d like to send it to another activity in my project but I don´t know how.
I have read that there is: intent.putStringArrayListExtra();
but it is to send an arrayList and in my case if I use that it says that it´s expecting an arrayList<String>
and I´m providing an
ArrayList<ArrayList<String>>
.
Any idea? Thank you.
Asked
Active
Viewed 33 times
0

louisMay
- 23
- 3
-
you can convert it to a serializeable object and then pass it along. – Sagar Mar 22 '23 at 11:44
-
And how is that? Sorry, but I don´t know a lot about java – louisMay Mar 22 '23 at 11:47
-
maybe this can help. https://stackoverflow.com/a/39252048/3900210 – Sagar Mar 22 '23 at 11:51
1 Answers
0
You can convert your arrayList of arrayLists into jason, then pass the string to the other activity. Then in the activity, decode the json into your object. Check out the Gson library from google.

Kristy Welsh
- 7,828
- 12
- 64
- 106