Created
May 29, 2012 09:36
-
-
Save johnkil/2823551 to your computer and use it in GitHub Desktop.
Check heap size on the android device
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.miz.heapsize; | |
import android.app.Activity; | |
import android.app.ActivityManager; | |
import android.os.Bundle; | |
import android.widget.TextView; | |
public class CheckHeapActivity extends Activity { | |
private TextView text; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
ActivityManager am = ((ActivityManager)getSystemService(Activity.ACTIVITY_SERVICE)); | |
int memory = am.getMemoryClass(); | |
int largeMemory = am.getLargeMemoryClass(); | |
text = (TextView) findViewById(R.id.textView1); | |
text.setText("Normal heap size: " + memory | |
+ "\nLarge heap size: " + largeMemory); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment