I have a Drawable generated by a library,it makes round image with letter inside.
But in the view that I have to insert, accepts only url, and I need to convert this drawable to a url, but I don't know how to do it.
The Drable looks like:
TextDrawable drawable = TextDrawable.builder()
.buildRound(mConnection.getUser().substring(0, 1).toUpperCase(), ContextCompat.getColor(getApplicationContext(),mConnection.getContactStatus(mcontact).getColor()));;
thanks in advance
Stop using that
Viewand switch to another one that accepts aDrawable.If you want to waste the user's RAM, CPU, and battery, you can draw the
Drawableto aBitmap-backedCanvas, write thatBitmapout to a file (e.g., PNG) usingcompress(), then try using afile:///URL.Your question title suggests using a
data:URL. Unless the documentation for this unidentifiedViewspecifically claims that theViewsupports thedatascheme, most likely it does not.