Android-从活动中启动另一个应用程序 [英] Android- launch another app from activity
本文介绍了Android-从活动中启动另一个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个单击按钮时启动外部应用程序(例如shazam)的活动.可能吗?怎么办?
I want to create an activity that launches an external app (shazam for example) on button click. Is it possible? How can it be done?
谢谢!
推荐答案
我找到了解决方案.在应用程序的清单文件中我找到了我的包名称:com.package.address和我要启动的Mainctivity的名称:
I found the solution. In the manifest file of the application I found My package name: com.package.address and the name of the Mainctivity which I want to launch:
以下代码启动此应用程序:
The following code starts this application:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.package.address","com.package.address.MainActivity"));
startActivity(intent);
这篇关于Android-从活动中启动另一个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文