get Free Disk Size - Android android.os

Android examples for android.os:Disk

Description

get Free Disk Size

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();
  }/*w  w  w  . j  a  v a  2  s  . com*/

}

Related Tutorials