传递的ArrayList<双>从一个活动在Android上另一个活动 [英] Pass ArrayList<Double> from one activity to another activity on android

查看:215
本文介绍了传递的ArrayList<双>从一个活动在Android上另一个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我保存的ArrayList<双> 我的bean类,

I've stored ArrayList<Double> on my bean class,

我已经bean类在我的主要活动,

I've the bean class on my main activity,

如何通过的ArrayList&LT;双&GT; <?/ code>,从我的主要活动到另一个活动

How to pass the ArrayList<Double> ,from my main activity to another activity.?

我的数组列表加倍。如何通过双数组列表?

My array list is double. how to pass double arraylist ?

推荐答案

这一次可以帮助你......

This one helps you...

public Intent putParcelableArrayListExtra (String name, ArrayList<? extends Parcelable> value)

有关更多信息看<一href="http://developer.android.com/reference/android/content/Intent.html#putParcelableArrayListExtra%28java.lang.String,%20java.util.ArrayList%3C?%20extends%20android.os.Parcelable%3E%29">putParcelableArrayListExtra

编辑:

如果你有一个双[] 那么你可以使用

If you have a double[] then you can use

无效putDoubleArray(字符串键,双击[]值)中的捆绑类。

插入一个双数组值这个捆绑的映射,替换现有的值给定键。 而这个包传递到意图的其他活动。

Inserts a double array value into the mapping of this Bundle, replacing any existing value for the given key. And pass this bundle to Intent to Other Activity.

更新:2

FirstActivity:

Intent intent = new Intent(this, OtherActivity.class);
ArrayList<Double> listDouble = new ArrayList<Double>();
listDouble.add(1111.00000);
listDouble.add(13331.00000);
intent.putExtra("arraylist", listDouble);
startActivity(intent);

OtherActivity:(检索双人间ArrayList中)

OtherActivity: (Retrieve Double ArrayList)

ArrayList<Double> listDouble = (ArrayList<Double>) getIntent().getSerializableExtra("arraylist");
System.out.println("...serialized data.." + listDouble);

这篇关于传递的ArrayList&LT;双&GT;从一个活动在Android上另一个活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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