I need an button, wich can bee in "pressed" and "unpressed" state set programmatically, i use method .setPressed(true), and button keeps this state until a popup menu or action menu showed, then button goes to "unpressed" state. Is this a bug in android or something else? how can i keep "pressed" state of button until required action taken to "unpress"?
Asked
Active
Viewed 164 times
2
-
You are maybe looking for a ToggleButton? http://developer.android.com/reference/android/widget/ToggleButton.html – donfuxx Mar 02 '14 at 10:09
-
Use an ToggleButton or an CheckBox – Kitesurfer Mar 02 '14 at 10:36
-
Your problem could be http://stackoverflow.com/a/28788780/852795. It's difficult to tell exactly what you're doing, but if the button is altering it's own state with `.setPressed()` then you need to use a Handler to invoke this after a short delay. "`Button.setPressed(true)` will not work if you are clicking the button, because Android will reset it once you let go of the button." – Mark Cramer Sep 25 '16 at 04:16