在活动中导航离开屏幕的等效操作是什么。就像你按下后退按钮,活动就消失了。如何从一个活动内部调用这个函数,以便它关闭自己。
What about the Activity.finish() method (quoting) :
Activity.finish()
Call this when your activity is done and should be closed.
you can use this.finish() if you want to close current activity.
this.finish()
finish() method is used to finish the activity and remove it from back stack. You can call it in any method in activity. But make sure you close all the Database connections, all reference variables null to prevent any memory leaks.
you can use finishAffinity(); to close all the activity..
finishAffinity();
You Can use just finish(); everywhere after Activity Start for clear that Activity from Stack.
finish();