Skip to content Skip to sidebar Skip to footer

Vibrator In Android

How to create Vibrator object and call vibrate function? http://developer.android.com/reference/android/os/Vibrator.html doesn't give much information regarding how to create the o

Solution 1:

I think you're looking for:

Vibrator bzzz = (Vibrator) getSystemService(VIBRATOR_SERVICE);

See the docs.


Solution 2:

You have to create the object then call the function object.vibrate whith vibration period in milliseconds

Vibrator v = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE);
// To vibrate for 1 second
v.vibrate(1000);

Post a Comment for "Vibrator In Android"