我想启动另一个应用程序并放入其他内容。我尝试这样做:
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;
}
}