0

I am implementing a swipe to delete, and I am drawing an icon as a bitmap in the background. For some reason my icon variable is still null even though the xml icon file do exist and android studio displays the icon at the beginning of the line.

 Bitmap icon;
 if (dX > 0) {
    icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_delete_black_24dp);

enter image description here

user54517
  • 2,020
  • 5
  • 30
  • 47
  • Is `getBitmapFromVectorDrawable` a function that I should implement somewhereit just something that I have to check ? It seems that all my parameters for the gradle or good – user54517 Mar 27 '20 at 09:47
  • 1
    If you are using Android ktx lib, just use `AppCompatResources.getDrawable(context, drawableId).toBitmap()` - otherwise you would to implement your own function. – Froyo Mar 27 '20 at 09:55
  • Nice, I implemented the given function and it works :D Could you put it as a response ? – user54517 Mar 27 '20 at 10:06

0 Answers0