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.. } 

check link .. sp!! , sp_dev!! more on saredpreference


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -