英文:
How to enable back button of phone to go back to previous activity without enabling back button icon on action bar?
问题
假设我从当前活动切换到另一个活动,然后需要通过手机上原本存在的返回按钮回到先前的活动,同时还有一个主页按钮和菜单按钮。我已经禁用了我的操作栏,并且不想启用它。我也不想在我的活动中创建一个代表返回的图标。
请帮忙!
英文:
Suppose I move to another activity from my current one and then I need to go back to previous activity by pressing the back button originally present in the phone along with a home button and menu button. I have disabled my Action Bar and I don't want to enable it. Nor I want to create an icon in my activity that represents back.
Please Help!
答案1
得分: 1
要启动返回操作,您可以从您的活动中调用以下代码:
super.onBackPressed();
英文:
to initiate the back operation you can call
super.onBackPressed();
from your activity.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论