Skip to content

Instantly share code, notes, and snippets.

@kpbird
Created July 24, 2013 11:34
Show Gist options
  • Save kpbird/6069796 to your computer and use it in GitHub Desktop.
Save kpbird/6069796 to your computer and use it in GitHub Desktop.
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");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment