Reputation: 559
I want to pass HashMap object through intent. My Hashmap is contains String and List. HashMap> listDataChild; I want to pass listDataChild to next activity?
Upvotes: 0
Views: 586
Reputation: 15775
Attach it to the Intent as part of a Bundle
. HashMap
is Serializable
so it will work in a Bundle
or even as a Extra
to the intent.
Upvotes: 0
Reputation: 7439
Try below code:
Intent intent=new Intent(CURRENT CLASS.this, CLASS TO CALL.class);
intent.putExtra("test", YOUR HASHMAP);
startActivity(intent);
In another Activity get data like below:
HashMap<String, List<String>> data=(HashMap<String, List<String>>) this.getIntent().getSerializableExtra("test");
Upvotes: 1