【发布时间】:2013-06-09 07:50:22
【问题描述】:
当我在 Android 中使用 HashMap 和 Integer 键和数据值时,我在 Eclipse 中收到此消息:
Use new SparseIntArray(...) for better performance
现在的问题是SparseIntArray() 没有实现Serializable 接口,不能与onRestoreInstanceState() 中的getSerializable() 和putSerializable() 一起使用。
使用
SparseIntArray()而不是HashMap<Integer, Integer>有多重要?我应该费力使
SparseIntArray可序列化吗? (我的第一个想法是制作一个实现Serializable的包装类,这是正确的方法吗?)
【问题讨论】: