Tuesday, 15 May 2012

Progressbar is not showing with background process

For one of my project I had a long running process prior to display root activity but somehow I couldn't been able to display the progressbar properly. Thee gone through some of the firum and I found this as a rendering problem. Due to CPU bounded process UI renderer stops rendering.  So somehow I need to stop the other process prior to display the progress bar. For that I have used thread with postdelay, here is a pseudo code

ProgressBar.visibility=View.VISIBLE;
MyHandler.postDelayed(new Runnable() {
public void run() {
   //Move all the code here.
     ProgressBar.visibility=View.GONE;          
 }
                    }, 3000);

So now my progress bar got  3000 ms to display itself in the view holder.

Hope this help to save someone's time :-)

No comments:

Post a Comment