Repeat an action as long button is pressed
android, button, java, repeat, textview
Solution
A general approach (not specific to Android) would be to detect the press and release event separately. The press event starts a periodic task (`Runnable` or `Thread`) which adds to the counter (let us say 5 times a second, or once every 200 ms). The release event stops the periodic task.
Problem
Let's say you have a `TextView` that displays an number like 0 and you have a `Button`. Now if the user presses the Button the Number in the TextView will increase for one (this i know how to do) but if the user presses the Button and don't release it then the number in the `TextView` should be increased an this should repeat it self as long the user don't release the `Button`. In other words: How to increase the Number over and over again as long the user holds down the Button?