android打开当前应用市场简单方法 (ActivityNotFoundException 异常解决)

try{

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=" + getPackageName()));
startActivity(intent);

}catch (ActivityNotFoundException e) {

System.out.printf("抱歉,你没有安装应用市场");

}

系统找不到对应的打开界面就会触发该异常。

原文地址:https://www.cnblogs.com/xBig/p/4335644.html