I am trying to create an activity that changes backgrounds once someone clicks (and holds) an image of a button in the middle of the screen. The app will switch back to its normal background once the button is released.
So far I’ve tried placing a button in front of the “area” to press and set its visibility to invisible.
Is there a better way to do this? Is there a way to sense if the person let go of the button? (e.g. on button pressed do some stuff, when button released do other stuff)
Thanks
You want something like NumberPickerButton and NumberPicker.
You should enable long clicking (setLongClickable(true)) on your button.
Then respond to both onLongClick event, and the onTouchEvent, if action is UP.
Your event handlers should look something like this: