小编Sar*_*lou的帖子

如何在Android应用程序中将用户重定向到默认启动器?

自从我试图找出如何开发使用NFC身份验证的Android解锁屏幕应用程序以来,已经很久了.我正在与Nexus S合作.经过多次互联网研究,我得出的结论是,现在不支持将锁定屏幕替换为第三方应用程序,我们需要修改平台以进行体面的实施.

这就是为什么我开发了一个主屏幕应用程序,给出了解锁屏幕应用程序的错觉.但我的问题是我希望在程序结束时重定向到默认的laucher.

我首先尝试使用下面的代码,但问题是我可以在默认主屏幕和我的新应用程序之间进行选择

Intent goHome = new Intent();
i.setAction("android.intent.action.MAIN");
i.addCategory("android.intent.category.HOME");
startActivity(goHome);
Run Code Online (Sandbox Code Playgroud)

所以我然后尝试使用下面的代码,但它似乎不起作用.

Intent goHome = new Intent(Intent.ACTION_MAIN);
goHome.setClassName("com.android.launcher", "com.android.launcher.Launcher");
startActivity(goHome);
Run Code Online (Sandbox Code Playgroud)

我得到以下logCat

无法找到显式活动类(com.android.launcher.laucher)

你知道为什么它不起作用吗?这是正确的做法吗?

android launcher homescreen android-activity

3
推荐指数
1
解决办法
4348
查看次数

标签 统计

android ×1

android-activity ×1

homescreen ×1

launcher ×1