手机自带储存的讲解

来源:互联网 发布:tcp端口号怎么看 编辑:程序博客网 时间:2024/05/01 23:05

现在很多手机都是自带储存的,有一些还不能外置SD。

今天我们就来讲一下如何获取手机自带储存的路径。其实手机自带的储存的获取方法和外置SD卡是一样的。手机自带储存是被当成SD来处理的。


<span style="white-space:pre"></span>
<span style="white-space:pre"></span>File sdDir = null;        if (Environment.getExternalStorageState()                .equals(android.os.Environment.MEDIA_MOUNTED)){            sdDir = Environment.getExternalStorageDirectory();        }        textView.setText(sdDir.toString());

<span style="white-space:pre"></span>这样就可以获取到手机自带储存的路径了。
<span style="font-weight: bold; white-space: pre;"></span><strong>但有一些手机是不把自带储存挂在</strong><span style="color: rgb(51, 51, 51); font-size: 12.5px; letter-spacing: 0.5px; line-height: 22.5px;"><strong><span style="font-family:Microsoft YaHei;">挂载到 Environment.getExternalStorageDirectory()这个结点上;</span></strong></span>
<span style="color: rgb(51, 51, 51); font-size: 12.5px; letter-spacing: 0.5px; line-height: 22.5px;"><strong><span style="font-family:Microsoft YaHei;"><span style="white-space:pre"></span>所以就算这样也不能获取的;</span></strong></span>
<span style="white-space:pre"></span>遇到这种情况请看下面的链接:
<span style="white-space:pre"></span>http://my.oschina.net/liucundong/blog/288183
<span style="white-space:pre"></span>
0 0