实现app之间的跳转

一、先判断要跳转到的目标app是否在手机上安装

PackageManager packageManager = getPackageManager();
PackageInfo packageInfo = null;
try {
    packageInfo = packageManager.getPackageInfo("目标app的包名",PackageManager.GET_ACTIVITIES);
} catch (PackageManager.NameNotFoundException e) {
    e.printStackTrace();
 Toast.makeText(MainActivity.this,"没有该应用",Toast.LENGTH_SHORT).show();
}
二、跳转

if(packageInfo!=null){
    Intent intent = packageManager.getLaunchIntentForPackage("目标app包名");
    startActivity(intent);
}


你可能感兴趣的:(Android)