Which method is more efficient for creating Bitmap out of Drawable from resources?
Bitmap myBitmap = BitmapFactory.decodeResource(context.getResources(),
R.drawable.icon_resource);
Vs
Drawable myDrawable = getResources().getDrawable(R.drawable.icon_resource);
Bitmap myBitmap = ((BitmapDrawable) myDrawable).getBitmap();
since API 22 above method is deprecated so use following
Drawable myDrawable = ContextCompat.getDrawable(context, R.drawable.icon_resource)