android - get the size of data partition by coding -


i have test code using :

  $ adb -s emulator-5554 shell     # df    df  /dev: 47084k total, 0k used, 47084k available (block size 4096) /sqlite_stmt_journals: 4096k total, 0k used, 4096k available (block size  4096) /system: 73600k total, 73600k used, 0k available (block size 4096) /data: 65536k total, 18464k used, 47072k available (block size 4096) /cache: 65536k total, 1156k used, 64380k available (block size 4096) 

you see data have total 65536k , on,my question how size coding?if need root right?can give me advice?

try {  runtime rt = runtime.getruntime();  process pcs = rt.exec("df /data");  bufferedreader br = new bufferedreader(new inputstreamreader(pcs        .getinputstream()));  string line = null;  while ((line = br.readline()) != null) {     log.e("line","line="+line);  }  br.close();  pcs.waitfor(); 

or

    file path = environment.getdatadirectory();     android.os.statfs stat = new android.os.statfs(path.getpath());     long blocksize = stat.getblocksize();     long availableblocks = stat.getavailableblocks()*blocksize; 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -