Reputation: 11
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.
Upvotes: 1
Views: 887
Reputation: 1701
You can use alternative of getResources().getDrawable(int id)
as mentioned below
ContextCompat.getDrawable(Context context,int drawableId)
Upvotes: 4