I am trying to have several buttons to give several different vibrator buzz types upon press. I am able to feed in the variable" day with. The vibrator only vibrates three times very shortly and then plays the toast and then stops. It doesn't get to the 16 vibrate patterns on case:1.
I have a switch, because i will have 26 more pattern-sets to lay down.
public void vibratorCheckerTester(int day)
{
// Get instance of Vibrator from current Context
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
long[] startpattern = {0, 200, 200};
long[] pattern1 = {0, 500, 1000};//sleep one minute
long[] pattern2 = {0, 500, 3000}; //sleep 1.5
if(!v.hasVibrator())
{
Toast.makeText(daybuzzer.this,
"You need to have a vibrator on your phone for this app to work.", Toast.LENGTH_LONG).show();
}
// Start without a delay
// Vibrate for 100 milliseconds
// Sleep for 1000 milliseconds
Toast.makeText(daybuzzer.this,
"Start Running.", Toast.LENGTH_LONG).show();
v.vibrate(startpattern, -1);
v.vibrate(startpattern, -1);
v.vibrate(startpattern, -1);
switch(day){
case 1: v.vibrate(pattern1, -1); //1 min, 1.5 min, x8
v.vibrate(pattern2, -1);
v.vibrate(pattern1, -1);
v.vibrate(pattern2, -1);
v.vibrate(pattern1, -1);
v.vibrate(pattern2, -1);
v.vibrate(pattern1, -1);
v.vibrate(pattern2, -1);
v.vibrate(pattern1, -1);
v.vibrate(pattern2, -1);
v.vibrate(pattern1, -1);
v.vibrate(pattern2, -1);
v.vibrate(pattern1, -1);
v.vibrate(pattern2, -1);
v.vibrate(pattern1, -1);
v.vibrate(pattern2, -1);
v.vibrate(startpattern, -1);
v.vibrate(startpattern, -1);
v.vibrate(startpattern, -1);
break;
}
}