I have an adapter which extends from BaseAdapter and in this, I am trying to display a set of images. Before rendering the images, I have to dynamically change the width and height of each image and I am able to accomplish it by dynamically loading image from an external URL and then modifying the resulting bitmap's width and height.
In case if any of the image fetch fails, I have a backup image which needs to be rendered. This is stored in "res" folder as part of the resources. Currently, I am doing this in the adapter constructor:
Drawable drawable = context.getResources().getDrawable(R.drawable.backup);
Bitmap backupBitmap = ((BitmapDrawable)drawable).getBitmap();
and in the getView method, I dynamically change the width and height of this backup bitmap as well since I want it to have the same width and height as others in the list.
Please let me know if this approach is correct or if I need to change something? Will the backupBitmap cause memory or performance issues? Please advise.