Sunday, 11 August 2013

Set all except first to false

for(int i = 0; i < options.length; i++) {
    if(found)
        options[i] = false;
    else
        found = options[i];
}

Friday, 2 August 2013

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

If your application using asynctask and you call
 view.onRefreshComplete();  
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()  
 {  
   view.setAdapter(null);  
   //stuff  
   handler = new Handler();  
   handler.postDelayed(runnable, DELAY_MILLIS);  
 }  
And here is the runnable field:

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