启动另一个应用程序

问题描述 投票:1回答:1

我想启动另一个应用程序并添加额外的东西。我尝试这样做:

private void open() {
 openApplication(getActivity(), "com.app.package.here");
}

public void openApplication(Context context, String packageN) {
 Intent i = context.getPackageManager().getLaunchIntentForPackage(packageN);
 if (i != null) {
  i.addCategory(Intent.CATEGORY_LAUNCHER);
  i.putExtra(PGO_GET, pgo != null ? pgo : pgogb);
  context.startActivity(i);
 } else {
  try {
   context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageN)));
  } catch (android.content.ActivityNotFoundException anfe) {
   context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + packageN)));
  }
 }
}

但它没有用。

在loginActivity的第二个活动中我有这个:

  Object ob = getIntent().getExtras().getSerializable(PGOOptionsDialog.PGO_GET);
        if (ob != null) {
            if (ob instanceof PGOGet) {
                currentPGO = (PGOGet) ob;
            } else if (ob instanceof PGO) {
                pgodb = (PGO) ob;
            }
        }
java android
1个回答
0
投票

我想你正在体验我半年前的same problem。要快速测试,请尝试发送String而不是Serializable。

© www.soinside.com 2019 - 2024. All rights reserved.