如果我按下并停止振动,如果我移动我的手指,如何使设备振动?现在这适用于声音,但不适用于振动,这是代码`
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
// TODO Auto-generated method stub
if(MotionEvent.ACTION_DOWN == arg1.getAction())
{
mp.start();
df= (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
}
else
if(MotionEvent.ACTION_UP == arg1.getAction())
{
mp.stop();
try {
mp.prepare();
try {
df.wait(arg1.getDownTime());
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//df.cancel();
}
return false;
}
});
}
`