How to Get bitmap from drawable: Android

To get Bitmap from resource image

Bitmap bitmap = ((BitmapDrawable)getResources().getDrawable(R.drawable.test)).getBitmap();

 

It will return the Bitmap 

 

To get the Bitmap from Imageview

 Drawable imgDrawable = imageview.getDrawable();
       
 Bitmap bitmap = ((BitmapDrawable) imgDrawable).getBitmap();

 

Android Exmple to Convert Drawable to Bitmap

 

How to change app icon Android studio

 


Subscribe For Daily Updates

Flutter Questions
Android Questions