以编程方式获取操作系统大小的android? [英] Get operating system size android programmatically?
问题描述
当我使用此代码时,Operting系统大小返回与移动设备上的硬件不同。如何在Android中获得操作系统大小?
在我的手机上的值是3.4 G,但是当我使用我的代码时结果是1.17。
这是我的真实手机和我的代码结果之间的比较。
Operting system size return not m not same with hardware on mobile, when i use this code. How to get operating sistem size in android?
On my phone value is 3.4 G, but when i use my code result is 1.17.
And this is compare between my real phone with my code result.
Name |Phone|MyCode
Total Storage |8 |5.81
System |3.4 |1.17
Internal Storage|4.64 |4.64
我尝试过什么:
文件pathOS = Environment.getRootDirectory(); // Os存储
StatFs statOS =新的StatFs(pathOS。 getAbsolutePath());
long total_OS_memory = 0; long free_OS_memory = 0;
total_OS_memory =(statOS.getBlockCountLong()* statOS.getBlockSizeLong());
What I have tried:
File pathOS = Environment.getRootDirectory();//Os Storage
StatFs statOS = new StatFs(pathOS.getAbsolutePath());
long total_OS_memory=0;long free_OS_memory=0;
total_OS_memory= (statOS.getBlockCountLong()*statOS.getBlockSizeLong());
推荐答案
我建议你阅读:
java - 如何检查Android设备上的可用空间?在SD卡上? - 堆栈溢出 [ ^ ]
Android获得内部/外部内存的免费大小 - Stack Overflow [ ^ ]
I'd suggest to read this:
java - How to Check available space on android device ? on SD card? - Stack Overflow[^]
Android get free size of internal/external memory - Stack Overflow[^]
这篇关于以编程方式获取操作系统大小的android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!