简体   繁体   English

如何将文件存储在内置的外部存储中

[英]How to get files stored in inbuilt external storage

I had created a mdatabase.db file on the sdcard in a directory named MyDataBase, this is fine, when i open the sdcard via phone the dir and files are showing, but when i connected the device to system and open via system the created files are not showing. 我已经在名为MyDataBase的目录中的sdcard上创建了mdatabase.db文件,这很好,当我通过电话打开sdcard时会显示目录和文件,但是当我将设备连接到系统并通过系统打开创建的文件时没有显示。 Help me please 请帮帮我

This problem is arriving only in inbuilt sdcard devices for me 对于我来说,此问题仅在内置的SD卡设备中出现

DataBasepath mnt/sdcard/MyDataBase/mdatabase.db DataBasepath mnt / sdcard / MyDataBase / mdatabase.db

use this code to Checking media availability 使用此代码检查媒体可用性

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;
}

do your code depend on that 您的代码是否依赖于此

for more detail 了解更多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM