如果检测SD卡present与否总是返回true [英] Detecting if SD card present or not always returns true

查看:203
本文介绍了如果检测SD卡present与否总是返回true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序,在那里我试图检查SD卡是present或不specfic task.I现在用的是code从下面的链接来检查它来执行。

I am developing an android app, where i am trying to check if SD card is present or not to perform a specfic task.I am using the code from the below link to check it.

<一个href="http://stackoverflow.com/questions/7429228/check-whether-the-sd-card-is-available-or-not-programatically">Check SD卡是否可用与否编程

现在的问题是,在code工作正常,我的许多电话,但在我的Galaxy S,即使我没有SD卡,isSDcard present永远是正确的。

The problem is , the code is working fine for many of my phones, but on my Galaxy S , even if i dont have a SD card, the isSDcardpresent is always a true.

不知道是什么问题,请帮帮忙!谢谢!

Not sure what the problem is, Please help! Thanks!

推荐答案

总是有一个外部存储目录,即使设备没有SD卡, 看<一href="https://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory%28%29"相对=nofollow> getExternalStorageDirectory :

There is always an 'external' storage directory, even for device without SD card, see getExternalStorageDirectory :

请注意:千万不要被这个词迷惑外部在这里。此目录   可以更好地被认为是媒体/共享存储。它是一个文件系统,   可以容纳比较大量的数据和被跨越共享   所有的应用程序(不强制许可)。传统上,这是   SD卡,但它也可以被实现为内置存储在一个   装置,其从被保护的内部存储不同,并且可以是   作为安装在计算机上的文件系统。

Note: 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.

这也的不可以是真正的SD卡,看到的数据存储指南

It may also not be the real SD card, see Data storage guide :

这有可能是一个设备使用内部存储的分区   外部存储也可以提供一个SD卡插槽。在这种情况下,   SD卡是不是外部存储的一部分,你的应用程序不能   访问(额外的存储仅供用户提供媒体   该系统扫描)。

It's possible that a device using a partition of the internal storage for the external storage may also offer an SD card slot. In this case, the SD card is not part of the external storage and your app cannot access it (the extra storage is intended only for user-provided media that the system scans).

我认为这个问题是SD卡present?应翻译为可用的共享目录?

I think the question 'is the SD card present ?' should be translated to 'is the shared directory available ?'.

这篇关于如果检测SD卡present与否总是返回true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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