if (!Environment.getExternalStorageState().equals(

Environment.MEDIA_MOUNTED)) {// 判断SD卡是否可用

alertSdErr();
}


public void alertSdErr() {
AlertDialog.Builder ab = new AlertDialog.Builder(this);
ab.setMessage("SD卡不可用");
ab.setPositiveButton("退出", new DialogInterface.OnClickListener() {


@Override
public void onClick(DialogInterface dialog, int which) {
theActivity.this.finish();
}


});
ab.show();
}