Reputation: 275
caused by a string object is reading as null which is initialized.
public String lastAction = "";
in onCreate
lastAction = model.lastAction;
it's working perfectly on the first onCreate
, but when we go to the second activity and that lastAction
object is null
when back to previous activity using intent.
Upvotes: 1
Views: 55
Reputation: 9056
Just do operation
if(lastAction!=null){
//do all stuff here
}
OR
pass your object through onBackPress()
method of second-activity
.
OR
Save your object
into sharefrefernce
and get it when onCreate()
when Activity
called and onRestart()
when activity
will come out from stack.
Upvotes: 1