I actually have an app that I test with two devices. One LG GW620, and one Samsung Spica. I would like when User touch the screen, the device vibrate.
In fact, On t
Almost all solutions on the internet seem to missing something . . (context) heres a working solution . . .
Vibrator v = (Vibrator) getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(100);
Funny. In your onClick for the button you should put the vibrate. And since it is in miliseconds I'd put something like 500 for half a second instead of .1 seconds.
void onCreate() {
mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
Button b = (Button) findViewById(R.id.button);
b.setOnClickListener(new View.OnClickListener() {
void onClick() {
mVibrator.vibrate(500);
}
});
}