1
0 Comments

Convert Drawable to Bitmap Android code

Showing images from internet get time to load on the screens, some times we need to show images from the drawable folder on dynamically. We can show images from drawable folder by setImageResource() and setImageBitmap() methods. In this post we will cover how to convert drawable to bitmap in android. we will show you convert drawable to bitmap and append this bitmap image to Imageview

To Convert Drawable to Bitmap we will use BitmapFactory.decodeResource() property. This property takes two arguments.

Resource Instance
Resource ID
val bitmap = BitmapFactory.decodeResource(resources, R.drawable.control_staements)

Convert Drawable to Bitmap

on July 15, 2021
Trending on Indie Hackers
1 small portfolio change got me 10x more impressions User Avatar 31 comments AI Is Destroying the Traditional Music Business and Here’s Why. User Avatar 29 comments Fixing my sleep using public humiliation and giving away a Kindle User Avatar 23 comments From 1k to 12k visits: all it took was one move. User Avatar 11 comments Retention > Hype: What Are We Really Chasing as Builders? User Avatar 9 comments I Built IdeaBridgeHub in 4 Months with AI & Zero Coding Experience — A Proof-First Founder OS. Private Beta in ~1 Week. User Avatar 9 comments