从代码启动android应用程序

从代码启动android应用程序,android,android-activity,android-intent,Android,Android Activity,Android Intent,我需要从我的代码简单地启动一个应用程序,如Skype或其他。 我在网上读了一些帖子,但我没有找到答案。 我试过这个方法: Intent startApp = new Intent("com.android.gesture.builder"); startActivity(startApp); 我在try/catch blokk中写了这篇文章,日志告诉我:applicationnotfoundexception由Intent处理。我在Android开发者网站上读了“Hello”教程,但对于我的解

我需要从我的代码简单地启动一个应用程序,如Skype或其他。 我在网上读了一些帖子,但我没有找到答案。 我试过这个方法:

Intent startApp = new Intent("com.android.gesture.builder");
startActivity(startApp);
我在try/catch blokk中写了这篇文章,日志告诉我:applicationnotfoundexception由Intent处理。我在Android开发者网站上读了“Hello”教程,但对于我的解决方案来说,它太复杂了。。。 我无法将此应用程序启动活动注册到我的清单文件。 我想我需要实现一个新类,它从活动扩展而来,实现上面的代码,然后重试?
请帮助我,如何从我的主要活动轻松启动其他应用程序…

您就快到了!:

你只需要提供你想要的应用程序包和类

// 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)

我还看到你可以用第二种方法:

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

请看:

我喜欢你的第二种方式!这对我有用,非常感谢:)这是一个非常彻底的问题。干得好。