Intent startMain = new Intent(Intent.ACTION_MAIN); //指定跳到系统桌面
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); //清除上一步缓存
startActivity(startMain); //开始跳转
System.exit(0);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); //清除上一步缓存
startActivity(startMain); //开始跳转
System.exit(0);
本文介绍了一种通过发送特定意图来实现应用程序跳转至系统桌面的方法。具体步骤包括创建一个具有ACTION_MAIN动作和CATEGORY_HOME类别的Intent,并设置清除顶部活动的标记,最后启动该Intent以完成跳转。
3042

被折叠的 条评论
为什么被折叠?



