如何从活动返回到主屏幕 [英] How to return to home screen from Activity
本文介绍了如何从活动返回到主屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
据我们所知,机器人可以返回主屏幕,每当我们preSS主页键, 我现在希望我的ImageButton表现为主页键,它可以通知主屏幕,前台,我应该怎么code我onClickListener完成这件事?
什么想法?
解决方案
意向意图=新的意图(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(意向);
as we know, android can return home screen whenever we press the Home-key, I now want my Imagebutton to behave as the Home-key,which can inform the home screen to foreground, how should I code my onClickListener to get this done?
any ideas?
解决方案
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent);
这篇关于如何从活动返回到主屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文