存储Parcelable对象以Android的文件 [英] Storing a Parcelable object to a File in Android
问题描述
我试图对象ResolveInfo的ArrayList保存到一个文件中,这样我就不必每次我的应用程序启动(约4-6秒)ResolveInfo对象Parcelable重建它,但不能序列化,所以我得到一个java.io错误,当我尝试写的对象。
I am trying to store an ArrayList of ResolveInfo objects to a file so that I don't have to rebuild it each time my application launches (about 4-6 seconds) ResolveInfo objects are Parcelable, but not Serializable so I get a java.io error when I try to write the objects.
我已存储他们在我savedInstanceState捆绑,但在关闭应用程序时没有帮助。我做得完全错误的?
I have stored them in my savedInstanceState bundle, but that doesn't help when closing the application. Am I doing something plain wrong?
推荐答案
savedInstance信息不会在多个会话保存。你真的要实施序列化
保存 ResolveInfo
。
savedInstance info will not save across multiple sessions. You will really want to implement Serializable
to save your ResolveInfo
.
这篇关于存储Parcelable对象以Android的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!