android手机存储大小设置在哪里看,Android 最新获取手机内置存储大小,SD卡存储空间大小方法...
在以前我們都是這樣獲取的
//Android API18之前:fs.getAvailableBlocks()*fs.getBlockSize()
目前:
/** 得到系統(tǒng)可用內(nèi)存 **/
@SuppressLint("NewApi")
private String getMemFree(){
StatFs fs = new StatFs(Environment.getDataDirectory().getPath());
return Formatter.formatFileSize(this, (fs.getAvailableBytes()));
}
/** 得到SD可用內(nèi)存 **/
@SuppressLint("NewApi")
private String getSdFree(){
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
StatFs fs = new StatFs(Environment.getExternalStorageDirectory().getPath());
//Android API18之前:fs.getAvailableBlocks()*fs.getBlockSize()
return Formatter.formatFileSize(this, (fs.getAvailableBytes()));
}
return "未裝載";
}
終于解決問題了,嘎嘎
原文:http://blog.csdn.net/oydaybreak/article/details/41824721
總結(jié)
以上是生活随笔為你收集整理的android手机存储大小设置在哪里看,Android 最新获取手机内置存储大小,SD卡存储空间大小方法...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ios c语言头文件,iOS开发 --
- 下一篇: android恶意代码检测报告,用机器学