public static boolean displayMemoryInformation(Activity activity){
  long freeSize=0L;
  long totalSize=0L;
  long usedSize=-1L;
  try {
    Runtime info=Runtime.getRuntime();
    freeSize=info.freeMemory();
    totalSize=info.totalMemory();
    usedSize=totalSize - freeSize;
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  Log.e(LOW_MEMORY_LOG_TAG,"---------------------------------------------------");
  Log.e(LOW_MEMORY_LOG_TAG,"usedSize   " + (usedSize / 1048576L) + " MB");
  Log.e(LOW_MEMORY_LOG_TAG,"freeSize   " + (freeSize / 1048576L) + " MB");
  Log.e(LOW_MEMORY_LOG_TAG,"totalSize  " + (totalSize / 1048576L) + " MB");
  Log.e(LOW_MEMORY_LOG_TAG,"---------------------------------------------------");
  ActivityManager.MemoryInfo mi=new ActivityManager.MemoryInfo();
  ActivityManager activityManager=(ActivityManager)activity.getSystemService(Context.ACTIVITY_SERVICE);
  activityManager.getMemoryInfo(mi);
  Log.e(LOW_MEMORY_LOG_TAG,"availMem   " + (mi.availMem / 1048576L) + " MB");
  Log.e(LOW_MEMORY_LOG_TAG,"totalMem   " + (mi.totalMem / 1048576L) + " MB");
  Log.e(LOW_MEMORY_LOG_TAG,"threshold  " + (mi.threshold / 1048576L) + " MB");
  Log.e(LOW_MEMORY_LOG_TAG,"lowMemory  " + (mi.lowMemory));
  Log.e(LOW_MEMORY_LOG_TAG,"---------------------------------------------------");
  return mi.lowMemory;
}

public static boolean displayMemoryInformation ( Activity activity ) { long freeSize = 0L ; long totalSize = 0L ; long usedSize = - 1L ; try { Runtime info = Runtime . getRuntime ( ) ; freeSize = info . freeMemory ( ) ; totalSize = info . totalMemory ( ) ; usedSize = totalSize - freeSize ; } catch ( Exception e ) { e . printStackTrace ( ) ; } Log . e ( LOW_MEMORY_LOG_TAG , "---------------------------------------------------" ) ; Log . e ( LOW_MEMORY_LOG_TAG , "usedSize   " + ( usedSize / 1048576L ) + " MB" ) ; Log . e ( LOW_MEMORY_LOG_TAG , "freeSize   " + ( freeSize / 1048576L ) + " MB" ) ; Log . e ( LOW_MEMORY_LOG_TAG , "totalSize  " + ( totalSize / 1048576L ) + " MB" ) ; Log . e ( LOW_MEMORY_LOG_TAG , "---------------------------------------------------" ) ; ActivityManager . MemoryInfo mi = new ActivityManager . MemoryInfo ( ) ; ActivityManager activityManager = ( ActivityManager ) activity . getSystemService ( Context . ACTIVITY_SERVICE ) ; activityManager . getMemoryInfo ( mi ) ; Log . e ( LOW_MEMORY_LOG_TAG , "availMem   " + ( mi . availMem / 1048576L ) + " MB" ) ; Log . e ( LOW_MEMORY_LOG_TAG , "totalMem   " + ( mi . totalMem / 1048576L ) + " MB" ) ; Log . e ( LOW_MEMORY_LOG_TAG , "threshold  " + ( mi . threshold / 1048576L ) + " MB" ) ; Log . e ( LOW_MEMORY_LOG_TAG , "lowMemory  " + ( mi . lowMemory ) ) ; Log . e ( LOW_MEMORY_LOG_TAG , "---------------------------------------------------" ) ; return mi . lowMemory ; }
log the memory statuses .
