如何从Android中的另一个应用程序启动活动 [英] How to launch an Activity from another Application in Android
本文介绍了如何从Android中的另一个应用程序启动活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从我的Android应用程序启动已安装的软件包.我认为可以使用Intent,但是我没有找到一种方法.有链接,在哪里可以找到信息?
I want to launch an installed package from my Android application. I assume that it is possible using intents, but I didn't find a way of doing it. Is there a link, where to find the information?
推荐答案
如果您不知道主要活动,则可以使用软件包名称来启动应用程序.
If you don't know the main activity, then the package name can be used to launch the application.
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
if (launchIntent != null) {
startActivity(launchIntent);//null pointer check in case package name was not found
}
这篇关于如何从Android中的另一个应用程序启动活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文