How to pass List <Map <String, String >> using putExtra to another intent

In my project, I have AsyncTask that retrieves some JSON data from the network from which I create

List<Map<String,String>> typesCategory = new ArrayList<Map<String, String>>(); 

Now I need to pass this list on to my next intention. If you look at the API, I donโ€™t see methods that support list passing. What is the best way to do this?

  protected void onPostExecute(List result) { progress.dismiss(); Intent action = new Intent(this, ListTypeActivity.class); action.putExtra("data", result); } 
+4
source share
1 answer

Custom data can be transmitted via Bundle , Parcelable or Serializable , depending on your needs. In the case of Parcelable, you can even pass an array of them.

In addition, ArrayList already implements Serializable , and also implements most Map implementations.

+4
source

Source: https://habr.com/ru/post/1338661/


All Articles