检查手机上面是否安装存储卡的判断

来源:互联网 发布:水泵扬程计算软件 编辑:程序博客网 时间:2024/05/22 12:39
/**
     * 检测储存卡是否安装
     */
    private boolean mopo() {
String status = Environment.getExternalStorageState();
if (status.equals(Environment.MEDIA_MOUNTED)) {
file();
return true;
} else {
new AlertDialog.Builder(MainActivity.this).setTitle("提示:")
       .setMessage("非常抱歉!\n您不能正常使用本软件,可能是以下原因所导致。\n⒈未检测到你手机里的存储卡设备。\n⒉软件经过其他人所修改导致安装文件时出错。\n\n按确定退出本软件! ").setIcon(R.drawable.ic_launcher)
       .setPositiveButton("确定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
finish();
}


}).show();
}

return false;
}
0 0