Java tutorial
//package com.java2s; // Use of this source code is governed by a BSD-style license that can be import android.annotation.TargetApi; import android.os.Build; import android.os.StatFs; public class Main { @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) private static long getSizeUpdatedApi(StatFs statFs) { return statFs.getAvailableBytes() / (1024 * 1024); } }