English | Site Directory

Android - An Open Handset Alliance Project

android.os
public class

android.os.Vibrator

java.lang.Object
android.os.Vibrator

Class that operates the vibrator on the device.

If your process exits, any vibration you started with will stop.

Summary

Public Constructors

          Vibrator()

Public Methods

        void  cancel()
Turn the vibrator off.
        void  vibrate(long[] pattern, int repeat)
Vibrate with a given pattern.
        void  vibrate(long milliseconds)
Turn the vibrator on.
Methods inherited from class java.lang.Object

Details

Public Constructors

public Vibrator()

Public Methods

public void cancel()

Turn the vibrator off.

public void vibrate(long[] pattern, int repeat)

Vibrate with a given pattern.

Pass in an array of ints that are the times at which to turn on or off the vibrator. The first one is how long to wait before turning it on, and then after that it alternates. If you want to repeat, pass the index into the pattern at which to start the repeat.

Parameters

pattern an array of longs of times to turn the vibrator on or off.
repeat the index into pattern at which to repeat, or -1 if you don't want to repeat.

public void vibrate(long milliseconds)

Turn the vibrator on.

Parameters

milliseconds How long to vibrate for.
Build m5-rc15g - 14 May 2008 12:50