6

I need simple start an application from my code, like Skype, or other one. I read some thread, on the internet, but I haven't solution. I tried this methode:

Intent startApp = new Intent("com.android.gesture.builder");
startActivity(startApp);

I wrote this in try/catch blokk, and the LogCat told me: ApplicationNotFound exception handled by Intent. I read the "Hello" tutorial on the Android Developers site, but it's too comlicated, to my solution... I can't register this application starting activity to my manifest file. I think I need to implement a new class, that extends from Activity, and implement, the code above, and try again? Please help me, how can I start other application from my main activity easy...

Bence Ignácz
  • 106
  • 3
  • 13

1 Answers1

5

You were nearly there!:

You just need to supply the package and class of the app you want.

// Try
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setComponent(new ComponentName("com.htc.Camera", "com.htc.Camera.Camera"));
startActivity(intent);
// catch not found (only works on HTC phones)

ComponentName

I also just saw you can do it a second way:

  PackageManager packageManager = getPackageManager();
  startActivity(packageManager.getLaunchIntentForPackage("com.skype.android"));

See: SOQ Ref

Community
  • 1
  • 1
Blundell
  • 75,855
  • 30
  • 208
  • 233