0
I need to pass List<Carro> carro
using Intent
of a Activity
to or Activity
.
Car is a class with several elements String modelo, String categoria Double potencia
0
I need to pass List<Carro> carro
using Intent
of a Activity
to or Activity
.
Car is a class with several elements String modelo, String categoria Double potencia
1
First, make your class implement Serializable, example:
public class Carro implements Serializable{}
In your Internet you cast a serializable:
List<Carro> list = new ArrayList<Carro>();
myIntent.putExtra("LIST", (Serializable) list);
In the second Activity you can get the list like this:
Intent i = getIntent();
list = (List<Carro>) i.getSerializableExtra("LIST");
There are more performatic ways to pass parameters between acitivities using Parcelable.
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.
And extremely recommended to use Parcelable, since a list can be great, consider using an Asynctask to run putExtra or getSerializableExtra.
– Henrique Luiz