Last Updated: February 25, 2016
·
2.373K
· ketan parmar

How to identify memory limits per application in your Android device?

How to identify memory limits per application in your Android device. This solution require API level 11.

package com.example.androidnative;

import android.app.Activity;
import android.app.ActivityManager;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends Activity {

  @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ActivityManager activityManager = (ActivityManager) getApplication().getSystemService(ACTIVITY_SERVICE);
        Log.i("Test", "Large Memory Limit " + activityManager.getLargeMemoryClass() + " MB");
        Log.i("Test", " Memory Limit  " + activityManager.getMemoryClass() + " MB");
    }
}