java - Fetch total Memory of Android Device -


i trying fetch total memory of android device. returns me 24gb. however, total internal memory of device 32gb.

i tried using ...

public long getinternalfreespace()    {     //get free bytes...     long bytesavailable = stat.getblocksizelong() * stat.getavailableblockslong();     return bytesavailable; } 

use this:

public static long getavailableinternalmemorysize() {     file path = environment.getdatadirectory();     statfs stat = new statfs(path.getpath());     long blocksize = stat.getblocksize();     long availableblocks = stat.getavailableblocks();     long size = availableblocks * blocksize;     long availableblocksinkb = size /= 1024;     long availableblocksinmb = availableblocksinkb /= 1024;     return availableblocksinmb; } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -