Android: Get initialization code to run every time user launches app -


i have app main activity (a) menus, , separate activities (b, c, d) tasks selected menu. have initialization code in oncreate(). if user leaves app pressing home button, , re-launches tapping app icon, oncreate() not run. cannot put initialization code in onrestart(), runs when user returns menu after task run b. how can code run on every launch, on launch?

first need understand how android life cycle works: http://developer.android.com/training/basics/activity-lifecycle/index.html

enter image description here

basically, need run code on onresume , onstart depending on want achieve


edit:

since icon launches view intent, check intent when application resumed or restarted.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -