I have a bitmap in memory at run-time. I want to set the background of a text view to this bitmap. I am not able to find any standard procedure for that (not a hacky one). If anybody has worked in this area, please help!
set bitmap to background of ImageView with imageView. setImageBitmap method.
According to the API docs, setBackgroundResource expects an int.
If you definitely need a bitmap, you can use setBackgroundDrawable instead and wrap your bitmap in a BitmapDrawable. example
textureView.setBackground(new BitmapDrawable(getResources(), bitmap));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With