I am trying to save hashmap of arraylist. I am using custom class MailMessage which is itself parcelable. How can I save the Hashmaps? I am saving/restoring map as:
<code>
HashMap<String, ArrayList<MailMessage>> emailsMap = new HashMap<String, ArrayList<MailMessage>>();
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putSerializable("emailsMap", emailsMap);
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle state) {
// TODO Auto-generated method stub
super.onRestoreInstanceState(state);
emailsMap = (HashMap<String, ArrayList<MailMessage>>) state.getSerializable("emailsMap");
}
</code>
But in restore instance state, i am getting empty map. What can be the issue? I am saving restoring in right way?