我正在开发一个 android 游戏,我在其中使用此代码进行振动
public void gameover() {
prefs = activity.getSharedPreferences("AUTHENTICATION_FILE_NAME", Context.MODE_WORLD_WRITEABLE);
String vibration = prefs.getString("vibration", null);
if(vibration != null) {
if(vibration.equals("on")) {
Vibrator v = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(100);
}
}
}
但它在不断地振动。我想在 100 毫秒后停止这种振动,但它并没有停止。我应该怎么办?