I have a slight problem implementing vibration functionality in my application.
My code is:
public class VibrationActivity extends Activity {
private Vibrator vib;
private long[] pattern = { 0, 500, 200, 500 };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
vib = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);
}
public void onClick(View v) {
int id = v.getId();
if (id == R.id.button1) {
vib.vibrate(pattern, -1);
}
}
}
I have declared the using statement in the manifest also so that’s not the issue. When ever I click on a button nothing actually happens… Any one got any ideas?
Thanks in advance!
use this code :