I want the device to vibrate as long as the user clicks the button. If the user press the button for a long period of time the device is to vibrate as long as the user clicks and holds. here is what I implemented but it works for a particular period of time.
final Button button = (Button) findViewById(R.id.button1);
button.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if(v==button){
Vibrator vb = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vb.vibrate(1000);
}
return false;
}
});