I want to get the drawable id which is shown in the screen. I used if(getResources().getDrwable(binding.image1)==R.drawable.image){ //my stuff} But this is depreciated.
Asked
Active
Viewed 125 times
1 Answers
3
You can use alternative of getResources().getDrawable(int id)
as mentioned below
ContextCompat.getDrawable(Context context,int drawableId)

jayesh gurudayalani
- 1,368
- 1
- 9
- 14