安卓:保存阵列的应用程序数据 [英] Android: Save array to app data
本文介绍了安卓:保存阵列的应用程序数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能整个数组(甚至ArrayList中)保存到Android应用程序的数据?
Is it possible to save an entire array (or even ArrayList) to the android app data?
据我所知,你只能做的东西一样putInt,putBoolean或putString .... 但对于更复杂的数据类型? 有没有办法做到这一点?
As far as I know you can only do stuff like putInt, putBoolean or putString.... But what about more complex data-types? Is there a way to do that?
还是我必须对整个阵列第一次转换为字符串,然后解析它在磁盘阵列上的负载?
Or do I have to convert the whole array to a String first, and then parse it to an array again on load?
推荐答案
对于复杂的数据类型使用
for complex data-types use
Bundle bundle = new Bundle();
bundle.putSerializable("key", object);
intent.putExtra("bundle", bundle);
编辑:或阵列,可以使用
EDit: or for Arrays use
putStringArray(key,value);
这篇关于安卓:保存阵列的应用程序数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文