-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

  • Please post the code, not images... – Cristian Gomez May 24 '18 at 14:42
  • 3
    Welcome to Stack Overflow! Please post your code as code, not as images. You should indent the code snippet by 4 spaces to get them in `code markdown`. Use the "edit" link below your post to edit the question. – S.L. Barth May 24 '18 at 14:42

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,548
  • 1
  • 10
  • 16