Canvas do not update (invalidate) until whole while loop ends
<p>I'm trying to move a ball on canvas. a and b are similar to x,y coordinate positions. Any way from my code im trying to get different values dynamically. The a,b are global variables. But it seems that "invalidate()" or the refreshing of screen only happens afer end of the whole loop. Do you know why?. And if i have to build this on another thread please suggest me with some simple codes.  </p>

<pre><code>private void shootBall(){
    while (a&gt;b){
        a = getPositionX();
        b = getPositionY();
        invalidate();
        }
    }
}
</code></pre>
