Android : Avoid bitmap from being recycled automatically - Android

on Saturday, September 27, 2014


I am capturing screen whenever the screen is being touched and i am saving bitmaps in the ArrayList.



screen.setOnTouchListener(new OnTouchListener() {

@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
count++;
screen.setDrawingCacheEnabled(false);
screen.setDrawingCacheEnabled(true);

Bitmap b = screen.getDrawingCache();
bitmapList.add(b);
Log.e("Captured Image Number: ", ""+count);
return false;
}
});


And afterwards when i try to access the bitmaps to save them, they are no more there, recycled!

What should i do?

If i save here, it takes very long time.

Tried to convert into byte[] to avoid recycling, it also took long then expected.

I want to keep it upto 15fps what should i do.


0 comments:

Post a Comment