I need to pass List<Carro> carro
using Intent
of a Activity
to or Activity
.
Car is a class with multiple elements String modelo, String categoria Double potencia
I need to pass List<Carro> carro
using Intent
of a Activity
to or Activity
.
Car is a class with multiple elements String modelo, String categoria Double potencia
First, have your class implement Serializable , example:
public class Carro implements Serializable{}
In your intent you make a cast for 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 performative ways to pass parameters between acitivities using Parcelable .