【发布时间】:2013-06-26 11:11:07
【问题描述】:
我已经创建了振动手机的方法,代码运行良好,但我不能像“播放然后停止然后播放”那样振动。如何管理这种类型的振动?
代码
//@JavascriptInterface
public void Viber(String value )
{
// Get instance of Vibrator from current Context
Vibrator v = (Vibrator)mContext.getSystemService(mContext.VIBRATOR_SERVICE);
if (value.equals("on"))
{
// Vibrate for 300 milliseconds
v.vibrate(6000);
}
else
{
v.cancel();
}
}
【问题讨论】:
-
你试过android api demos vibrator sample吗?
标签: android eclipse vibration android-vibration