简体   繁体   English

启动任何已安装的活动

[英]Launch any installed activity

this is my first question I have searched for any launching activity questions and none worked for me(android 4.0.4), but works for others. 这是我搜索的所有启动活动问题中的第一个问题,没有一个对我有用(android 4.0.4),但对其他人有用。

I have already a list of every installed activity in the phone but I cannot launch them 我已经在手机中列出了所有已安装的活动,但是无法启动它们

ComponentName cm= new ComponentName("com.sonyericsson.extras.liveview","com.sonyericsson.extras.liveview.LAUNCH");
intent.setComponent(cm);
startActivity(intent);

that code is failing for me "unable to find explicit activity...", that constant strings may vary depending on selection, any way this doesn't work, neither does other solutions found here. 该代码对我来说是“无法找到明确的活动...”,该常量字符串可能会因选择而异,无论哪种方式都行不通,这里也找不到其他解决方案。 Logcat says that maybe I didn't declare the activity in the manifest.xml but of course I didn't, I want to start ANY activity just as ADW launcher does, also tried to use code from ADW source but didn't work. Logcat说,也许我没有在manifest.xml中声明活动,但我当然没有,我想像ADW启动器一样启动任何活动,也尝试使用ADW源代码,但是没有用。 Thanks in advance 提前致谢

Try using this instead 尝试使用它代替

String app = "com.sonyericsson.extras/liveview";
Intent intent = new Intent(Intent.ACTION_MAIN);             
intent.setComponent(ComponentName.unflattenFromString(app));             
intent.addCategory(Intent.CATEGORY_LAUNCHER);             
startActivity(intent); 

Try 尝试

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.sonyericsson.extras.liveview", "com.sonyericsson.extras.liveview.LAUNCH");
startActivity(intent);

I believe the name of the package is ok but the activity name being all CAPS hurts me :|, but try and let me know if it works for you. 我相信程序包的名称还可以,但活动名称全为CAPS会伤害我:|,但请尝试让我知道它是否对您有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM