get MemoryInfo : Memory « Hardware « Android






get MemoryInfo

  

import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.ActivityManager.MemoryInfo;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.net.Uri;
import android.text.Html;

 class Utils {
    
    public static MemoryInfo getMemoryInfo(Context _context) {
      MemoryInfo info = new MemoryInfo();
      getActivityManager(_context).getMemoryInfo(info);
      return info;
    }
    public static ActivityManager getActivityManager(Context context)
    {
      ActivityManager result = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
      if (result == null)
        throw new UnsupportedOperationException("Could not retrieve ActivityManager");
      return result;
    }
}

   
    
  








Related examples in the same category

1.Get memory information
2.Get Memory Size Strings
3.Get Used Memory Size
4.Get Free Memory Size
5.Get Total Memory Size
6.Calculates the free memory of the device. This is based on an inspection of the filesystem, which in android devices is stored in RAM.
7.Calculates the total memory of the device. This is based on an inspection of the filesystem, which in android devices is stored in RAM.
8.Get Memory Total
9.Get Memory Free
10.Memory information