workflow - Activity Conditional Flow -
i have movie ticket booking app. initial activity login activity there "continue guest" option in case doesn't want sign in or register.
then there details activity, can see movie details, has button allow user book movie, if signed in. if not, opens alert dialog register or sign in.
what want is, if going login activity details activity, want, after signing in, return details activity.
but if user in login activity when opens app, should go movie list activity.
use sharedpreferences
save credentials. example :
sharedpreferences preferences = preferencemanager.getdefaultsharedpreferences(this); sharedpreferences.editor editor = preferences.edit(); editor.putstring("activity","activityfromwhereusermoved"); editor.apply();
note: activityfromwhereusermoved whether directlogin or detailspage
and check in loginactivity
string
value of key activity
:
sharedpreferences preferences = preferencemanager.getdefaultsharedpreferences(this); string name = preferences.getstring("activity", ""); if(name.equalsignorecase("detailspage")) { //intent detailspage } else { //intent direct movie list.. }
Comments
Post a Comment