smileVann
smileVann

Reputation: 554

How can I add a vibrate event to the onLongClick() method?

How can I add a vibrate event to the onLongClick() method?

Upvotes: 0

Views: 1072

Answers (1)

blessanm86
blessanm86

Reputation: 31779

In your onLongClick listener use this

Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(1000);

Add this permission to your manifest file

<uses-permission android:name="android.permission.VIBRATE"/>

Upvotes: 3

Related Questions