I'm looking for a way to pass an object to another activity.
What I do is create it in an activity. And in the other I want to receive it and work with it. Try passing data by object data with intent.putExtra()
but it is not the most practical way to work.
Here is an example:
i.putExtra("nombre", jsonObject.optString("name"));
i.putExtra("apellido", jsonObject.optString("lastname"));
i.putExtra("telefono", jsonObject.optString("phone"));
i.putExtra("direccion", jsonObject.optString("address"));
i.putExtra("email", jsonObject.optString("usuario"));
And in the other activity I believe it:
usuario.setNombre(getIntent().getStringExtra("nombre"));
usuario.setApellido(getIntent().getStringExtra("apellido"));
usuario.setDireccion(getIntent().getStringExtra("direccion"));
usuario.setEmail(getIntent().getStringExtra("email"));
usuario.setTelefono(getIntent().getStringExtra("telefono"));
I would like to create it in the first activity and pass it as an object instead of passing data by data. Thanks.