设备要求外部存储,但是我没有SD卡 [英] Device claims external storage, yet I have no SD card

查看:130
本文介绍了设备要求外部存储,但是我没有SD卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

三星galaxy S3,没有SD卡,我用这个code,检查存储状态。

Samsung galaxy S3 with no SD card, I'm using this code to check storage states.

使用这个code:

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

因此​​,也许有人能向我解释,如果这款手机由于某种原因,把它的内部存储器和外部?还是什么?

So perhaps someone can explain to me if this phone for some reason treats it's internal memory as external? Or what?

推荐答案

getExternalStorageDirectory并不总是返回的SD卡。

谷歌医生说:

不要被这个词迷惑外部在这里,这个目录可以   更被认为是媒体/共享存储。这是一个文件系统,可以   持相对大量的数据,并且是在所有共享   应用程序(不强制许可)。传统上这是一个   SD卡,但它也可以被实现为内置存储在一个   装置,其从被保护的内部存储不同,并且可以是   作为安装在计算机上的文件系统。

"don't be confused by the word "external" here. This directory can better be thought as media/shared storage. It is a filesystem that can hold a relatively large amount of data and that is shared across all applications (does not enforce permissions). Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer."

有可能是机会,到/ mnt / SD卡指的是内置存储为您的手机。

There might be chances that "/mnt/sdcard" refers to the inbuilt storage for your phone.

这是更好地检查从 getExternalStorageDirectory 方法,无论是外接移动存储与否的返回路径

It is better to check the return path from the getExternalStorageDirectory method whether it is external removable storage or not.

您可以使用<一个href="http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory%28%29">Environment.isExternalStorageRemovable()检查了。

这篇关于设备要求外部存储,但是我没有SD卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆