I have created this simple application where the user clicks a button that results in a vibration pattern being executed.
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(pattern, -1);
Though, when the user presses that button it starts the pattern again which results in overlapping vibration patterns. I want the user to be able to press the button which will result in the pattern starting over without being mixed with the old pattern.
I have tried using v.cancel() before v.vibrate(). That did not help at all. I guess from my basic understanding v.cancel() starts async and this means the cancel does not happen right away. I have thought of modifying the settings but I have found out that, it will not help (I think). I have even thought of adding the vibration code in a separate thread or something then killing the thread altogether (will that help). I have to learn how to handle threads. I am trying to do this quickly due to project deadlines. If the thread idea is working for someone, please let me know so I learn threads.
I am just confused on why the SDK makes it hard to reset the vibration or stop it completely.