开发者

How to detect that file is located on SD card?

Is there any durable way to detect that is file located somewhere on external (detachable/dismountable) storage?

For sure there's a way to parse file path and extract file:///sdcard string, but as 开发者_StackOverflow社区we know on some devices this path can be different, e.g. file:///mount/sdcard or file:///sdcard, not saying that some modern devices support USB host mode, so file easily can be placed on usb stick attached to device.

Any ideas?


Get a location of external storage via Environment.getExternalStorageDirectory() and then compare it to the path of your file. Make sure you have the absolute path to your file.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜