1

This code works in API > 23 but in API 23 don't work. I need setBackground of the ImageButton one drawable image.

How do I solve this?


    ImageButton imgbt = findViewById(R.id.imgbt );

    imgbt .setBackgroundDrawable(new BitmapDrawable(EstadoDescritivo.this.getResources(), BitmapFactory.decodeResource(getResources(),
                                    R.drawable.ic_car)));

Thanks

1 Answers1

0

You can try this :

Instead of using setBackgroundDrawable

imgbt.setBackgroundResource(R.drawable.ic_car);

Hope this will help!

Kalpesh Rupani
  • 991
  • 4
  • 12