Good afternoon,
I'm starting to use Android Studio, in the following situation I'm stopped: has the MainActivity where through a recyclerView I have a listing, when clicking on one of these step listings as parameter to page 2 such item clicked and user logged in, however inside page 2 I have another recyclerView that opens other information on a page 3. The app for when I try to go back to page 2 because the parameters that came from MainActivity no longer exist.
MainActivity - Where I pass the parameters to page 2:
public void onItemClick(View view, int position) {
Carona carona = listaCaronas.get(position);
Intent i = new Intent(MainActivity.this, CorridaActivity.class );
i.putExtra("carona", carona );
i.putExtra("usuario", usuario );
startActivity( i );
}
Page 2 - Where has the data of the item clicked and the other recycler:
//Recupera dados do usuário
Bundle extras = getIntent().getExtras();
if( extras != null ){
if (getIntent().getExtras().containsKey("carona")
&& getIntent().getExtras().containsKey("usuario")) {
usuario = (Usuario) extras.getSerializable("usuario");
carona = (Carona) extras.getSerializable("carona");
//verificaStatusRequisicao();
}
}
That is, when I return from page 3 to 2 there is no longer the containsKey ("ride") and containsKey ("user").