get Free Memory - Android android.os

Android examples for android.os:Memory

Description

get Free Memory

Demo Code

import android.app.ActivityManager;
import android.app.ActivityManager.MemoryInfo;
import android.content.Context;

public class Main {

  public static long getFreeMemory(Context context) {
    MemoryInfo info = new MemoryInfo();
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    activityManager.getMemoryInfo(info);
    return info.availMem;
  }//from w  ww .j  a  v a 2s. c  o  m

}

Related Tutorials