如何存储和捆绑在Android的检索数组列表值 [英] how to store and retrieve array list value in bundle in android

查看:76
本文介绍了如何存储和捆绑在Android的检索数组列表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何机构可以告诉如何存储和android的举个例子检索捆绑数组列表值

can any body tell how to store and retrieve array list value in bundle in android give example

感谢

推荐答案

让我们如果数组列表中有串了。

Lets take if you array list has strings in it.

ArrayList<String> al = new ArrayList<String>();
al.add("test1");
al.add("test2");
al.add("test3");

现在,你可以把它放进包如下:

Now you can put it into bundle as follows:

Bundle value= new Bundle();
value.putStringArrayList("temp1", al);

如果你有自己的对象类型,而不是字符串中的​​ArrayList,那么你需要序列化ArrayList对象。

If you have your own object type instead of "String" in ArrayList then you need to serialize that ArrayList object.

这篇关于如何存储和捆绑在Android的检索数组列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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