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

    }
相關文章
相關標籤/搜索