重新加载位图列表
我有一个初始化活动,通过网络加载约 10 个位图。位图存储在静态变量中,然后启动主活动。从主活动中按“返回”或“主页”,然后导航回应用程序后,初始化过程将重新开始。看来我的主要活动一旦调用 onPause() 就会被销毁。我尝试过序列化位图,但它们太大了。保存和恢复这么多位图而无需再次执行初始化过程的最佳方法是什么?
I have an initialization activity that loads ~10 bitmaps over the network. The bitmaps are stored in a static variable and then the main activity is started. After pressing back or home from the main activity and then navigating back to the app, the initialization process starts over. Looks like my main activity is being destroyed as soon as onPause() is called. I've tried serializing the bitmaps, but they're too big. What's the best way save and restore this many bitmaps without having to go through the initialization process again?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用磁盘缓存来存储它们,请参阅 Android 培训课程 高效显示位图,课程缓存位图。
You should use a disk cache to store them see the Android Training class Displaying Bitmaps Efficiently, lesson Caching Bitmaps.