package com.github.ma1co.pmcademo.app;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ImageView;
import com.sony.scalar.provider.AvindexStore;

public class ImageActivity extends BaseActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.image);

        ImageView imageView = (ImageView) findViewById(R.id.imageView);
        long id = getIntent().getLongExtra("id", 0);

        Uri baseUri = AvindexStore.Images.Media.getContentUri(AvindexStore.Images.Media.EXTERNAL_DEFAULT_MEDIA_ID);
        byte[] imageData = AvindexStore.Images.Media.getScreennail(getContentResolver(), baseUri, id);
        Bitmap image = BitmapFactory.decodeByteArray(imageData, 0, imageData.length);

        imageView.setImageBitmap(image);
    }
}

@@ -234,16 +234,45 @@
 Store;%0A%0A
+import java.io.InputStream;%0A%0A
 public c
@@ -313,16 +313,43 @@
 ivity %7B%0A
+    private Bitmap image;%0A%0A
     @Ove
@@ -750,24 +750,22 @@
     
-byte%5B%5D imageData
+InputStream is
  = A
@@ -802,16 +802,27 @@
 reennail
+InputStream
 (getCont
@@ -858,23 +858,16 @@
         
-Bitmap 
 image = 
@@ -890,48 +890,17 @@
 code
-ByteArray(imageData, 0, imageData.length
+Stream(is
 );%0A%0A
@@ -945,11 +945,139 @@
 );%0A    %7D
+%0A%0A    @Override%0A    protected void onDestroy() %7B%0A        super.onDestroy();%0A        image.recycle();%0A        image = null;%0A    %7D
 %0A%7D%0A

Make ImageActivity less memory hungry