Reputation: 2340
I was trying to send List> list to another activity. I tried many ways but couldn't. Please help!
Upvotes: 0
Views: 442
Reputation: 3536
You could use Intent
hashMap.put("key", "value");
Intent intent = new Intent(this, otherActivity.class);
intent.putExtra("mapkey", hashMap);
startActivity(intent);
EDIT:
For fatching the value in otherActivity
Intent intent = getIntent();
HashMap<String, String> hashMap = (HashMap<String, String>) intent.getSerializableExtra("mapkey");
intent.getSerializableExtra("mapkey");
EDIT (Convert it back to List) try sth like:
HashMap<String, String> map = new HashMap<String, String>();
List<String> hashMap = new ArrayList<String>(map.values());
Happy coding!
Upvotes: 1