java - Android activity Lifecycle does not work properly -
i'm developing android 2d game in android studio.
i have problem activity lifecycle.
my question this:
i have 2 activities. 1 named launcheractivity, , other named mainactivity.
when first launch app, launcheractivity launches, , works fine.then, when go the mainacitivty, activity hold game, meaning has line : setcontentview(new gamecontroller(this)), still works fine. when go launcher activity, still works fine, when i'm trying go game, mainactivity, in second time, lifecycle follow:
oncreate(),onstart(),onresume(),onpause(),onstop(),onresume().
this ruining game, because have specific things in onstop() method, can not allow them executed when activity launch.
does know how fix ? doing wrong ?
if not clear, please ask me , explain.
android call onstop when the activity no longer visible. please review document. https://developer.android.com/guide/components/activities/activity-lifecycle.html
i hope can you.
Comments
Post a Comment