android在应用中打开另外的应用

  private void goToOtherApp(String packageName) {

    PackageManager pm = getPackageManager();

    Intent otherApp;

    try {

      otherApp = pm.getLaunchIntentForPackage(packageName);

      if (null == otherApp) {

        throw new PackageManager.NameNotFoundException();

      }

      otherApp.addCategory(Intent.CATEGORY_LAUNCHER);

      startActivity(otherApp);

    } catch (NameNotFoundException e) {

      // TODO Auto-generated catch block

      e.printStackTrace();

    }

你可能感兴趣的:(android在应用中打开另外的应用)