Android中的振动器

时间:2010-12-13 16:05:18

标签: android

如何创建Vibrator对象并调用振动功能? http://developer.android.com/reference/android/os/Vibrator.html没有提供有关如何创建对象(没有公共构造函数)的大量信息

2 个答案:

答案 0 :(得分:9)

我认为你在寻找:

Vibrator bzzz = (Vibrator) getSystemService(VIBRATOR_SERVICE);

请参阅docs

答案 1 :(得分:0)

你必须创建对象然后调用函数object.vibrate whith振动周期(毫秒)

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