get One App Max Memory - Android android.os

Android examples for android.os:Memory

Description

get One App Max Memory

Demo Code

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

public class Main {

  public static long getOneAppMaxMemory(Context context) {

    if (context == null) {
      return -1;//  w w  w .java  2  s . com
    }
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    return activityManager.getMemoryClass() * 1024 * 1024;
  }

}

Related Tutorials