When/why does my Java singleton instance get destroyed?

前端 未结 4 1861
刺人心
刺人心 2020-12-16 03:34

I have an android app that is setup to start a Java activity (call it MyJavaActivity), which in turn launches a NativeActivity. When the NativeActivity finishes it returns b

4条回答
  •  猫巷女王i
    2020-12-16 04:36

    Be sure to read the documentation on the process lifecycle:

    http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html#Lifecycle

    In this case, whenever your app is in the background (in terms of activities, none of your activities are visible to the user), your process can be killed at any time. If the user later returns to one of your activities, a new process will be created and a new instance of the activity created.

提交回复
热议问题