简单的方法来保存在LinkedList的Andr​​oid应用程序? [英] easy way to save a LinkedList in a Android Application?

查看:98
本文介绍了简单的方法来保存在LinkedList的Andr​​oid应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是保存在一个Android应用程序对象的列表中easyest或本机方式?

what is the easyest or native way to save a list of objects in a android application?

我需要保存它,然后将其加载应用程序时再次启动。

i need to save it and then load it when the app starts again.

将是不错的,也许有人有一个现成的使用库,这使得我的一切。

would be nice maybe someone have a ready to use library which makes everything for me.

推荐答案

让存储在的LinkedList 实施的 Parcelable 所以你可以把它们放在你的。该在 onSaveInstance 你可以把你的对象在使用:

Let your items stored in the LinkedList implement Parcelable so you can put them in your bundle. The in onSaveInstance you can put your objects in the bundle using:

bundle.putParcelableArrayList ("key", list);

onRestoreInstanceState 活动的获取数据从使用:

and in onRestoreInstanceState of your Activity get the data back from that bundle using :

bundle.getParcelableArrayList();

这篇关于简单的方法来保存在LinkedList的Andr​​oid应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆