Issue
For example: If I start some Service and create a separate thread on this Service, And the service is killed by system and other Android components (services/activities,e.t.c.) are killed too. But the thread and the app's process are still alive. Can I access Application.getInstance in this case? And when the app object is destroyed?
Solution
And the service is killed by system and other Android components (services/activities,e.t.c.) are killed too. But the thread and the app's process are still alive.
That combination does not exist.
Android terminates processes to free up system RAM. That's it. The only reason why components will be "killed" — with the process "still alive" — is if something destroys them (e.g., finish(), stopService(), stopSelf()). In general, the system does not do this on its own.
Can I access Application.getInstance in this case?
If your process is around, the Application instance is around.
And when the app object is destroyed?
Never. It goes away when the process does.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.