user192936
user192936

Reputation:

Vibrate after a long click

I am developing an Android app and at some point want to give the user ability to long press a view and after a short vibrate do some action.

I have tried onLongClick but it is triggered even on a very very short touch. I have read that the wait time cannot be changed; which makes it useless in my case. Am I missing something about that event?

If no, onTouchEvent is the only solution I guess. Is there a way to capture a long press with that event?

Upvotes: 2

Views: 1149

Answers (1)

snrlx
snrlx

Reputation: 5107

It sounds like you have not enabled long clicks. Please check whether calling the following method helps (taken from Android View Reference):

public void setLongClickable (boolean longClickable)

Upvotes: 2

Related Questions