-5

I'm clumsy.

solution on my problem

origin activity

    public void marcas(View view) {
    ArrayList<Localizacion> object = new ArrayList<Localizacion>(localizaciones);
    Intent intent = new Intent(getApplicationContext(), CompraVenta.class);
    Bundle args = new Bundle();
    args.putSerializable("ARRAYLIST", (Serializable) object);
    intent.putExtra("BUNDLE", args);
    startActivityForResult(intent, RESPUESTA_ACTIVIDAD);
}

destiny activity

    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_compra_venta);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    Intent intent = getIntent();
    Bundle args = intent.getBundleExtra("BUNDLE");
    ArrayList<Localizacion> object = (ArrayList<Localizacion>) args.getSerializable("ARRAYLIST");
    loc = object;
    enlaceInterfaz();
}

in the class Localizacion i'm implement Parceable. my mistake was to want to use the arrays like I use them in the java class and that's not how it works.

thanks for all

1 Answers1

0

Make your class as Parceable, and then you will be able to pass the list of objects of that class to another Activity.

class Localizacion implements Parceable {

}

Now to send data to another Activity.

intent.putParcelableArrayListExtra("array",object);

In receiving side

loc = getIntent().getParcelableArrayExtra("array");
Ghulam Moinul Quadir
  • 1,638
  • 1
  • 12
  • 17