Intent intent = mContext.getPackageManager()
.getLaunchIntentForPackage(“应用包名”);
if(intent==null){
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle("温馨提示:")
.setMessage("您未安装该应用,请先安装后再打开!");
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
//这里添加点击确定后的逻辑
}
});
builder.create().show();
return;
}
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
从一个应用打开另一个应用
最新推荐文章于 2021-05-29 00:41:50 发布