How to Convert Drawable to Bitmap in Android
http://www.viralandroid.com/2015/12/how-to-convert-drawable-to-bitmap-in-android.html
A Bitmap is a representation of a bitmap image. Android supports bitmap files in three formats .png, .jpg and .gif. Converting drawable image to bitmap is easy in android. This example teaches you to convert a drawable image to bitmap and display it in ImageView with simple java code.
In order to convert drawable image to bitmap in android, you have to use android.graphics.Bitmap and android.graphics.BitmapFactory.
Related:
Capture Image from Android Camera and Display it Programmatically
How to Open a URL in Android Browser from Application
Pick an Image From SD Card Gallery and Display in Android App
Following is the code of java activity file and XML layout file.
res/layout/convert_drawable_to_bitmap.xml
src/ ConvertDrawableToBitmap.java
res/values/strings.xml
Now, run you Convert Drawable to Bitmap in Android application, you will see ViralAndroid’s logo icon in the screen which is converted drawable to bitmap.
In order to convert drawable image to bitmap in android, you have to use android.graphics.Bitmap and android.graphics.BitmapFactory.
Related:
Capture Image from Android Camera and Display it Programmatically
How to Open a URL in Android Browser from Application
Pick an Image From SD Card Gallery and Display in Android App
Android Example: Convert a Drawable to a Bitmap in Android
Following is the code of java activity file and XML layout file.
XML Layout File
res/layout/convert_drawable_to_bitmap.xml
Java Activity File
src/ ConvertDrawableToBitmap.java
Strings.xml File
res/values/strings.xml
Now, run you Convert Drawable to Bitmap in Android application, you will see ViralAndroid’s logo icon in the screen which is converted drawable to bitmap.