如何以编程方式启动特定的应用程序?

如何以编程方式启动特定的应用程序?

问题描述:

我要启动特定应用程序.

I want to launch a specif application.

我知道如何进行Intent,但是如果有多个可以处理Intent的应用程序,我想避免选择菜单,我想直接转到特定的应用程序.希望这是有道理的.

I know how to do Intents but I want to avoid the selection menu if there are multiple apps that can handle the intent, I want to go directly to a particular app. Hope this makes sense.

您直接使用包名称/类,例如,创建一个新的意图来调用twidroid程序,您可以使用以下

You use the package name / class directly, for example to create a new intent to call the twidroid program you'd use the followinglink text:

 Intent intent = new Intent("com.twidroid.SendTweet");

您可能想在未安装应用程序时尝试尝试/捕获ActivityNotFoundException.

You'd probably want to put a try/catch around for a ActivityNotFoundException for when the application is not installed.