1

Vibrate from OnLongClickListener

view story
linux-howto

http://stackoverflow.com – Maybe someone can explain me, how to vibrate from OnLongClickListener properly. In method below the vibration is very short. If I set return false; vibration lasts for 5000ms as expected, BUT OnClickListener is fired. How should I vibrate from OnLongClickListener for whole period, and not fire OnClickListener? final Vibrator x = (Vibrator) getParent() .getSystemService(Context.VIBRATOR_SERVICE); button.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { x.vibrate(5000); return true; } }); (HowTos)