开发者

How should I refer to "external storage" in the UI on Android?

Apparently external storage on Android (re开发者_开发问答ferred to by Environment.getExternalStorageDirectory) doesn't have to be an SD card. In fact, it doesn't even have to be external!

How can I refer to this storage in the UI? For example, if it is currently not accessible, I want to surface an error to the user. If I say "external storage" or "SD card", I may confuse users of some devices. Is there a way to appropriately identify it?


A look at the docs for Environment.getExternalStorageDirectory():

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.

Sounds like shared storage would be a good term.


I need to solve the same problem, and I think I just found our solution!

http://developer.android.com/reference/android/os/Environment.html#isExternalStorageRemovable%28%29

The Environment class provides the following method:

public static boolean isExternalStorageRemovable()

Returns whether the primary "external" storage device is removable. If true is returned, this device is for example an SD card that the user can remove. If false is returned, the storage is built into the device and can not be physically removed.

Sounds like exactly what we need.

EDIT I just noticed it was added in API level 9, which may not have existed when you first asked this question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜