安卓:如果找到SD卡为present [英] android: finding if sd-card is present

查看:108
本文介绍了安卓:如果找到SD卡为present的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题。我有一个带有内置16GB的存储和2 GB的SD卡卡的Galaxy Tab的。

I am having a problem. I have a galaxy tab that comes with 16gb of internal storage and 2 gb of sd-card card.

当我用environment.getExternalStorageState,它返回安装。然而,当我从我的Galaxy Tab取出SD卡,它仍返回安装,因为它认为内部存储为外部存储。有没有什么办法的,我可以实际的SD卡和内部存储?区分

when I use environment.getExternalStorageState, it returns mounted. However, when I remove the sd-card from my galaxy tab, it still returns mounted because it considers the internal storage as the external storage. Is there any way in which I can differentiate between the actual SD-Card and the Internal Storage?

感谢

推荐答案

似乎没有成为这个目前任何公开的API。你可以通过查看检查/ proc /坐骑但随后你的code将设备无关,因为不是所有的设备在安装二次外部存储(SD卡)一样的地方。

There doesn't seem to be any public API for this currently. You could check by looking at /proc/mounts but your code would then be device-dependent, since not all devices mount secondary external storage (SD card) at the same place.

这篇关于安卓:如果找到SD卡为present的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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