Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass ArrayList<Double> from one activity to another activity on android

Tags:

android

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

I've the bean class on my main activity,

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

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

like image 450
RVG Avatar asked Jul 25 '12 11:07

RVG


1 Answers

This one helps you...

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

For more info look at putParcelableArrayListExtra

EDIT:

If you have a double[] then you can use

void putDoubleArray(String key, double[] value) of Bundle class..

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.

Update: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: (Retrieve Double ArrayList)

ArrayList<Double> listDouble = (ArrayList<Double>) getIntent().getSerializableExtra("arraylist");
System.out.println("...serialized data.." + listDouble);
like image 164
user370305 Avatar answered Oct 14 '22 07:10

user370305