I have this error when I run this code. It says java.lang.RuntimeException trying to use recycled bitmap
. They say I should use Bitmap.recycle()
but I'm having this error. Is my code correct?
Here is my code:
ImageView image = (ImageView) findViewById(R.id.imageView1);
Bitmap bMap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
image.setImageBitmap(bMap);
bMap.recycle();