Android的完成()方法 [英] Android finish() method
问题描述
我previously工作在C#中DOTNET开发,有 Application.exit()
输入法,它立即关闭该应用程序,并释放内存。
I previously works in c# dotnet development, there is Application.exit()
type method, which instantly close the app and release the memory.
我觉得这是应该的Android完成()方法来做到这一点。
I find that android "finish()" method which was supposed to do that
但它没有这样做,它继续应用程序,而不是释放内存。
我怎么能离开我的应用程序,因此所有的线程和内存将被释放?
but it not doing that, it continue the app and not releasing the memory. How i can exit my application, so all thread and memory will be released ?
推荐答案
Android的有2种活动,活动和ListActivity(延伸活动)。
Android has 2 kinds of activities, Activity and ListActivity (extends Activity).
您可以扩展这两个对正在使用的所有应用程序的活动。使用新的活动基地类通过重写的onCreate()和结束(),让您的活动的堆栈。
You can extend these two for all your app's activities being used. Use your new activity base classes to keep a stack of your activities by overriding onCreate() and finish().
在当你想戒烟,弹出你的活动从堆栈中,一个接一个,并呼吁结束这种方式。
In this way when you want to quit, pop your activities off the stack, one by one and call finish.
我知道这很费力,但它为我工作。
I know it's laborious, but it works for me.
这篇关于Android的完成()方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!