get Free Disk Size using StatFs - Android android.os

Android examples for android.os:Disk

Description

get Free Disk Size using StatFs

Demo Code

import android.content.Context;
import android.os.StatFs;

public class Main {

  public static long getFreeDiskSize(Context context) {
    StatFs statFs = new StatFs(context.getFilesDir().getAbsolutePath());
    return (long) statFs.getAvailableBlocks() * statFs.getBlockSize();
  }/*from  ww w . j  a  v a 2  s . c o  m*/

}

Related Tutorials