Android的 - 开始从ApplicationInfo实例的应用 [英] Android - Starting an application from an ApplicationInfo instance
问题描述
如果我有一个特定的应用程序的ApplicationInfo实例,我怎么能做出一个Intent来启动应用程序?
我试过
意向意图=新意图(ApplicationInfoInstance.packageName);
但它给出了一个例外。安装该应用程序如此异常是不是因为这一点。
我想我需要使用
setClassName(字符串的packageName,弦乐的className);
有人能告诉我获得这两个值?
因为大多数我的应用程序的回报 NULL 为 ApplicationInfoInstance.className;
感谢您。
如果我有一个特定的应用程序的ApplicationInfo实例,我怎么能做出一个Intent来启动应用程序?
块引用>有是在Android的启动程序没有这样的事。一个应用程序可能是零,这是在发射,旨在推出一个或几个活动。
您应该能够使用
getLaunchIntentForPackage()
的<一个href=\"http://developer.android.com/reference/android/content/pm/PackageManager.html\"><$c$c>PackageManager$c$c>得到一个意图
满足您的需求(或空,如果没有这样的意图
)。If I have an ApplicationInfo instance of a particular app, how can I make an Intent to launch the app?
I tried
Intent intent = new Intent(ApplicationInfoInstance.packageName);
but it gives an exception. The app is installed so the exception is not due to that.
I think I need to use
setClassName (String packageName, String className);
Could someone direct me to obtain these two values? Because most of my apps returns NULL for
ApplicationInfoInstance.className;
Thank you.
解决方案If I have an ApplicationInfo instance of a particular app, how can I make an Intent to launch the app?
There is no such thing as "launch the app" in Android. An "app" may have zero, one, or several activities that are in the launcher and are designed to be launched.
You should be able to use
getLaunchIntentForPackage()
onPackageManager
to get anIntent
that meets your needs (or null if there is no suchIntent
).这篇关于Android的 - 开始从ApplicationInfo实例的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!