0

我在名为 MyDataBase 的目录中的 sdcard 上创建了一个 mdatabase.db 文件,这很好,当我通过电话打开 sdcard 时显示目录和文件,但是当我将设备连接到系统并通过系统打开创建的文件时没有显示。请帮帮我

这个问题只出现在我的内置 sdcard 设备中

数据库 路径 mnt/sdcard/MyDataBase/mdatabase.db

4

1 回答 1

0

使用此代码检查媒体可用性

boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();

if (Environment.MEDIA_MOUNTED.equals(state)) {
    // We can read and write the media
    mExternalStorageAvailable = mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
    // We can only read the media
    mExternalStorageAvailable = true;
    mExternalStorageWriteable = false;
} else {
    // Something else is wrong. It may be one of many other states, but all we need
    //  to know is we can neither read nor write
    mExternalStorageAvailable = mExternalStorageWriteable = false;
}

你的代码是否依赖于此

了解更多详情

于 2013-05-01T13:06:37.337 回答