Android examples for android.os:Vibrator
vibrate by millisecond
import android.content.Context; import android.os.Vibrator; public class Main { public static void vibrate(Context $context, int $msec) { try {/*from www . j a v a 2 s. c o m*/ Vibrator vibrator = (Vibrator) $context.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate($msec); } catch (Exception e) { e.printStackTrace(); } } }