Does anyone know the proper way to programmaticall...
# android
o
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
a
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
o
yeah thanks, all I want is for the pressed image from my selector to be displayed while waiting for the response
d
call invalidate after you setPressed(true)
👍 1
a
https://stackoverflow.com/q/5975168/4407321 The answer is basically here. I'd be surprised if setPressed didn't invalidate internally