我已经存储了 ArrayList<Double>
在我的 bean 类上,
我的主要 Activity 有 bean 类,
如何传递ArrayList<Double>
, 从我的主要 Activity 到另一个 Activity 。?
我的数组列表是双重的。如何传递双数组列表?
最佳答案
这个可以帮助你...
public Intent putParcelableArrayListExtra (String name, ArrayList<? extends Parcelable> value)
有关更多信息,请查看 putParcelableArrayListExtra
编辑:
如果你有一个 double[]
那么你可以使用
void putDoubleArray(String key, double[] value)
Bundle类..
将 double 组值插入到此 Bundle 的映射中,替换给定键的任何现有值。 并将此包传递给 Intent to Other Activity。
更新:2
第一 Activity :
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<Double> listDouble = (ArrayList<Double>) getIntent().getSerializableExtra("arraylist");
System.out.println("...serialized data.." + listDouble);
关于android - 将 ArrayList<Double> 从一个 Activity 传递到 android 上的另一个 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11648312/