简体   繁体   中英

android process still alive after finishing activities

My application launches 3 activities. When I want to exit, I close these 3 activities calling finish method. The activity onDestroy methods are then called but the process is still alive... How is it possible?

This is perfectly normal. Android will keep your process around until such time as it needs to reclaim that process' memory. That way, if the user immediately returns to your application, your application will appear quicker -- Android does not have to fork a process and load your application into memory.

Try:

System.exit(0);

It will kill your Activity-process.

Edit: As mentioned in the comments below. This works much better: android.os.Process.killProcess(android.os.Process.myPid());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM