get heap size via Memory Class - Android Hardware

Android examples for Hardware:Memory

Description

get heap size via Memory Class

Demo Code


//package com.java2s;

import android.app.ActivityManager;

import android.content.Context;

public class Main {
    /**//from   w ww .  j a  v  a  2 s  .c om
     * @param context
     * @return
     */
    public static int getMemoryClass(Context context) {
        ActivityManager manager = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        int heapSize = manager.getMemoryClass();
        return heapSize;
    }
}

Related Tutorials