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
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
Post a Comment