Android的 - 模拟首页点击首页、Android

2023-09-05 06:27:58 作者:为我着迷吧.

我知道调用完成()的活动会产生相同的结果,如果用户点击后退按钮;是不是也有类似的事情,主页按钮? (想自动显示某些动作后主屏幕)。

I know calling finish() in activity will produce same result as if user clicked on Back button; is there a similar thing for Home button? (would like to automatically show Home screen after certain action).

编辑:另外,我想AP preciate同样的事情菜单和放大器;搜索按钮。

Also, I would appreciate same thing for Menu & Search buttons.

谢谢!

推荐答案

您可以简单地使用意向为:

You can simply use an Intent for that:

Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME);
startActivity(i);