converting drawable resource image into bitmap
Drawable myDrawable = getResources().getDrawable(R.drawable.logo);Bitmap myLogo = ((BitmapDrawable) myDrawable).getBitmap();
Since API 22 getResources().getDrawable()
is deprecated, so we can use following solution.
Drawable vectorDrawable = VectorDrawableCompat.create(getResources(), R.drawable.logo, getContext().getTheme());Bitmap myLogo = ((BitmapDrawable) vectorDrawable).getBitmap();