Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.image); // use the bitmap object bmp.recycle();
Bitmap bmp = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); // use the bitmap object if (!bmp.isRecycled()) { bmp.recycle(); }In this example, the bitmap object is created using the "createBitmap()" method, which creates a new bitmap object with the specified parameters. Before recycling the bitmap object, the "isRecycled()" method checks whether the bitmap object has already been recycled or not. Package Library: android.graphics