vibrate by millisecond - Android android.os

Android examples for android.os:Vibrator

Description

vibrate by millisecond

Demo Code

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();
    }
  }

}

Related Tutorials