I have a problem with passing an ArrayList
to another activity in Android Studio.
I created a ArrayList
that holds the data type Double
. The program should read it and print it in the console.
This is the code from the first activity:
Intent intent = new Intent(this, ergebnisse.class);
intent.putExtra("WLTP_list", Wlist);
startActivity(intent);
And this is the code from the second activity:
Bundle bundle = getIntent().getExtras();
ArrayList<Double> Wlist = (ArrayList<Double>) bundle.getDoubleArray("WLTP_list");
The part after the last equal sign is marked red and the error is:
Inconvertible types; cannot cast 'double[]' to 'Java.util.ArrayList<Java.lang.Double>'
I didn't change the type so I don't know why it is giving me that error.