
这个意图有效,但它会加载一个菜单,询问我想使用哪个应用程序(browser或Last.fm):
Intent i = new Intent();i.setData(Uri.parse("http://last.fm/music/" + headliner));i.setAction("androID.intent.action.VIEW");startActivity(i); 但是,我只是想启动Last.fm应用程序并跳过询问使用哪个应用程序的对话框,我想可能使用setPackage()方法会像这样工作:
i.setPackage("fm.last.androID"); 但它导致应用程序崩溃:
androID.content.ActivityNotFoundException: No Activity found to handle Intent { act=androID.intent.action.VIEW dat=http://last.fm/music/Rihanna pkg=fm.last.androID } 是否可以启动Last.fm应用程序? Here’s一份Last.fm的AndroIDManifest.xml副本供参考.
谢谢阅读,
托尼
我从我的应用程序中启动了市场上的Z-DeviceTest应用程序,没有像这样的问题:
final Intent intentDeviceTest = new Intent("androID.intent.action.MAIN"); intentDeviceTest.setComponent(new Componentname("zausan.zdevicetest","zausan.zdevicetest.zdevicetest"));startActivity(intentDeviceTest); 在我的情况下,我从logcat获取的信息是:
// dat=content://applications/applications/zausan.zdevicetest/zausan.zdevicetest.zdevicetest
// cmp=zausan.zdevicetest/.zdevicetest
为了知道如何使用正确的组件/类启动应用程序…对last.fm应用程序执行相同 *** 作
编辑:
我已经测试过从我自己的应用程序启动Last.fm,这样可以正常运行而没有任何错误:
final Intent intentDeviceTest = new Intent("androID.intent.action.MAIN"); intentDeviceTest.setComponent(new Componentname("fm.last.androID","fm.last.androID.LastFm"));startActivity(intentDeviceTest); 总结 以上是内存溢出为你收集整理的Android:为不同的第三方应用程序启动活动全部内容,希望文章能够帮你解决Android:为不同的第三方应用程序启动活动所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)