Does anyone know the proper way to programmaticall...
# android
Does anyone know the proper way to programmatically set the pressed state of an image button? I want to press an image button that will create an api call and then stay in a pressed state until receiving the response will take a few seconds. .setPressed from the Android View documentation does not seem to work and the code below does not work
stackoverflow 2
Unfortunately this isn’t kotlin related, so you may have better luck on stack overflow
You may also consider disabling the button during that duration, though it doesn’t look the same as pressed
👍 1
yeah thanks, all I want is for the pressed image from my selector to be displayed while waiting for the response
call invalidate after you setPressed(true)
👍 1
a The answer is basically here. I'd be surprised if setPressed didn't invalidate internally