I stuff a TreeMap into an intent:
private TreeMap<Long, Long> mSelectedItems;
...
mSelectedItems = new TreeMap<Long, Long>();
...
Intent intent = new Intent();
intent.putExtra("results", mSelectedItems);
setResult(RESULT_OK, intent);
and then attempt to read it back out in the calling activity:
TreeMap<Long, Long> results = (TreeMap<Long, Long>)
data.getSerializableExtra("results");
which causes:
E/AndroidRuntime(26868): Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to java.util.TreeMap
Well, sure, but since I'm not using HashMap anywhere in the code, and since TreeMap implements Serializable, this should work without error, no? Why is android trying to force a class on me that I'm not using?