Friday, 2 August 2013

PullToRefresh loading indeterminate progress bar doesn't hide, goes on and on

If your application using asynctask and you call
it is possible that time between setOnRefreshListener and onRefreshComplete will be relative small. This can create problem with not hiding loading bar.

To fix it try put in handler you function with hiding loading header bar for example like this:

 //my function which I call on asynctask finish  
 public void updateListView()  
   handler = new Handler();  
   handler.postDelayed(runnable, DELAY_MILLIS);  
And here is the runnable field:

 Runnable runnable = new Runnable() {  
   public void run() {  
       Log.d("xxx", "trying to hide refresh");  
       handler.postDelayed(this, DELAY_MILLIS);  
Handler will rerun itself and tries to hide loading header.