What I am looking for is to have a button where:
If you just push it, does nothing.
If you push and hold it for, let’s say, 3 seconds, perform an action().
Any idea of what to do?
Thank you in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to be able to specify the time, here is an implementation of
OnTouchListenerthat does that for you, without using aTimer:If you don’t need to specify the time, just go with an
OnLongClickListeneras suggested by others.