2. 定义VibratorUtil工具类,震动时间设为50ms。
public class VibratorUtil { public static void startVibrate(Activity activity){ Vibrator vibrator = (Vibrator)activity.getSystemService(Service.VIBRATOR_SERVICE); vibrator.vibrate(50); } public static void stopVibrate(Activity activity){ Vibrator vibrator = (Vibrator)activity.getSystemService(Service.VIBRATOR_SERVICE); vibrator.cancel(); } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)