0

How can you generate a Bitmap from an image to use with the Palette API? I tried imageView.getDrawable().getBitmap(), but AS couldn't resolve getBitmap(), so I checked the source code of Drawableand this method doesn't seem to be there anymore.

I also set imageView.isDrawingCacheEnabled = true, and then used imageView.drawingCache, but that crashes the app with IllegalArguementException: Bitmap is not valid

Adam Ahmed
  • 79
  • 1
  • 5
  • there is no `Drawable#getBitmap()` method but there is `Drawable#draw()` which you can use for drawing the `Canvas` – pskink Jun 13 '18 at 03:59
  • but most likely (i guess 99%) `imageView.getDrawable()` returns `BitmapDrawable` object, if so, you can call `getBitmap()` method on it – pskink Jun 13 '18 at 04:08
  • Possible duplicate of [Get Bitmap attached to ImageView](https://stackoverflow.com/questions/8306623/get-bitmap-attached-to-imageview) – Ganesh K Jun 13 '18 at 04:26

0 Answers0