How do I programmatically launch a specific application?

后端 未结 10 676
余生分开走
余生分开走 2020-11-29 03:43

I want to launch a specif application.

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

10条回答
  •  迷失自我
    2020-11-29 04:30

    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");
    

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

提交回复
热议问题