从 Receiver 启动外部活动
我得到了这个代码来启动 Googles Car Home:
Intent i = new Intent();
i.setClassName("com.android.carhome", "CarHome");
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
但是,我收到以下错误:
E/AndroidRuntime( 6604): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.carhome/com.android.carhome.CarHome}; have you declared this activity in your AndroidManifest.xml
如何在 anifest 中声明它?我用谷歌搜索了很多,但没有找到答案。
谢谢!
I got this this code to launch Googles Car Home:
Intent i = new Intent();
i.setClassName("com.android.carhome", "CarHome");
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
However, I got following error:
E/AndroidRuntime( 6604): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.carhome/com.android.carhome.CarHome}; have you declared this activity in your AndroidManifest.xml
How do I declare this in the anifest? I googled quite a lot, but didn't find the answer.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是您在清单中声明接收者的方式。
http://developer.android.com/guide/topics/manifest/receiver -element.html
但是,我不确定您是否可以启动外部意图作为接收者。您必须将其作为具有默认类别和所有其他内容的单独活动启动。
This is how you declare Receiver in your manifest.
http://developer.android.com/guide/topics/manifest/receiver-element.html
However, I'm not sure if you can start external intent as receiver. You must start it as separate activity with DEFAULT category and all that stuff.