Goodbye, I'm creating an app where in the first activity I filter the regions of the country and then I pass them through the following activity where I call a webservice with the respective filter to bring me the correct data, after that clicking on the filtered list opens another activity with the detail of the item clicked, but when I return to the list it tells me that the putextra is empty, the data that came from the filter of the first activity is lost, I hope to be clear.
First activity, I send the filter
if (position == 0) {
Intent intent = new Intent(Turismo.this,Contrato.class);
intent.putExtra("region",spinnerRegion.getSelectedItemPosition());
intent.putExtra("grilla",position);
startActivity(intent);
In the second I receive it and later I call the web service, until there all good. I filled a recyclerview for the view.
Intent intent = getIntent();
Bundle extra = intent.getExtras();
datoregion = (String)extra.get("region").toString();
String datgrilla = (String)extra.get("grilla").toString();
in the third activity I show the detail that brings the web service.
nombre.setText(getIntent().getStringExtra("nombre"));
descripcion.setText(getIntent().getStringExtra("descripcion"));
Picasso.with(context).load(getIntent().getStringExtra("imagen_public")).into(imageView);
When I come back from the third activity I get the error
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.os.Bundle.get (java.lang.String)' on a null object reference
I've found out about sharepreferences but I do not know where to put it. Thank you very much in advance.