protected static ActivityManager.MemoryInfo getMemInfo(Context ctx) {
        try {
            ActivityManager actManager = (ActivityManager) ctx.getSystemService(ACTIVITY_SERVICE);
            ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
            actManager.getMemoryInfo(memInfo);
            return memInfo;
        } catch (Exception e) {
            Log.e(TAG, "Error getting MemoryInfo.", e);
            return null;
        }
    }
protected static ActivityManager . MemoryInfo getMemInfo ( Context ctx ) { try { ActivityManager actManager = ( ActivityManager ) ctx . getSystemService ( ACTIVITY_SERVICE ) ; ActivityManager . MemoryInfo memInfo = new ActivityManager . MemoryInfo ( ) ; actManager . getMemoryInfo ( memInfo ) ; return memInfo ; } catch ( Exception e ) { Log . e ( TAG , "Error getting MemoryInfo." , e ) ; return null ; } }
Get MemoryInfo object representing the memory state of the application.

@param ctx Android application context
@return MemoryInfo object representing the memory state of the application