Arsalan Arsalan - 10 months ago 68
Android Question

How to vibrate mobile while scrolling android-wheel?

I want to vibrate mobile & play sound for each item change, when user scroll android-wheel.

I've seen this in the default time-picker of iPhone. When we scroll time in the time-picker, it plays ticking sound.

Is it possible? If yest then how ?

Kindly edit the question, If it is not asked correctly.


Try this:

import android.os.Vibrator;

ListView lv = (ListView)findViewById(;
        lv.setOnScrollListener(new OnScrollListener() {
            public void onScrollStateChanged(AbsListView view, int scrollState) {
Vibrator v = (Vibrator) this.context.getSystemService(Context.VIBRATOR_SERVICE);
                    // Vibrate for 500 milliseconds

Don't forget to include permission in AndroidManifest.xml file:

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