Fofole Fofole - 1 year ago 58
Android Question

Android Vibrate on touch?

I am trying to make my device vibrate when I touch an object on Screen. I am using this code:

Vibrator v = (Vibrator) getSystemService(getApplicationContext().VIBRATOR_SERVICE);

with the permission in the manifest file but I don't seem to get any results.
Any suggestions? Also, my hardware supports vibrate.


please try this :

Button b = (Button) findViewById(;
    b.setOnTouchListener(new OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            Vibrator vb = (Vibrator)   getSystemService(Context.VIBRATOR_SERVICE);
            return false;

and add this permission to manifest.xml

 <uses-permission android:name="android.permission.VIBRATE"/>