while loop android
<p>This is part of my code which vibrate for the random amount of time.     </p>

<pre><code>public boolean dispatchTouchEvent(MotionEvent ev) {            
    SharedPreferences appSettings = PreferenceManager.getDefaultSharedPreferences(this);        
    boolean doVibration = appSettings.getBoolean("vibrationCue", true);      

    // determine whether estimation or cue mode is active        
    if (!currentlyEstimating) {          
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {      
            Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);         
            // determine random timespan for cue(s)          
            initCueLength();          
            if (doVibration)             
            {             
                loopnum = 0;         
                while(loopnum &lt; 5) {           
                     v.vibrate(cueLength);         
                    loopnum ++;         
                }         
            }
        }
    }
}
</code></pre>

<p>I want the vibration to repeat for example for five time. But the while loop doesn't work. Can you guide me that what can be a problem?</p>
