I have a button and I want it to execute an action only while it is long pressed.
I am able to execute the action on the long press already. The problem is: I do not know how to stop it once the user is no longer pressing down on the button.
How do I go about implementing something like this?
I am using Jetpack Compose on an Android App.
The Gestures API is probably what you are after.
You can use something like:
You may also find other APIs regarding drag that match your requirements. May be worth expanding on what you are ultimately trying to accomplish.