Code example for ActivityManager

Methods: getMemoryInfo

0
	protected static final String TAG = "ImagePicker";
 
	public static void show(Activity currentActivity) {
		ActivityManager am = (ActivityManager)currentActivity.getSystemService(Activity.ACTIVITY_SERVICE);
		ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
		am.getMemoryInfo(mi);
 
		Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
		intent.setType("image/*");
		currentActivity.startActivityForResult(intent, IMAGE_PICKER_REQ_ID);
	} 
	 
	//note: this must be forwarded into by mActivity 
	//return a true if the image picker detects the proper request code 
	public static boolean isImagePickerActivityResult(int requestCode) {
		return requestCode == IMAGE_PICKER_REQ_ID;
	} 
	 
	public static Bitmap onImagePickerActivityResult(Activity currentActivity, int resultCode, int maxLength, Intent returnedIntent) {
		if (resultCode == Activity.RESULT_OK) {