android - DefaultHttpClient execute() method sometimes does not return -


in applicaiton, use shared defaulthttpclient perform http requests. in 1 of ui there listview used show data requested server , 'query more' button used request more data server starting asycntask peform requst.

items of listview clickable. when clicking 1 item app start new activity used show details data of clicked item. details data request performed in asynctask, , there problem: when click 'query more' button , in same time (maybe little later) click 1 item of listview, latter request(details data) responsed former request(more data)seems stuck in doinbackground of asynctask , never return, ideas?

here code of 'query more' task:

private class searchtask extends asynctask<void, void, group<venue>> {      private exception mreason = null;     private boolean mmore = false;     private int mfrom;      public searchtask(boolean moresearch,int startfrom){         mmore = moresearch;         mfrom = startfrom;     }      @override     public void onpreexecute() {         if (debug) log.d(tag, "searchtask: onpreexecute()");         if(!mmore) {             setprogressbarindeterminatevisibility(true);             setloadingview();                        }      }      @override     public group<venue> doinbackground(void... params) {         try {             return search(mfrom,anywhered.query_limit);         } catch (exception e) {             mreason = e;         }         return null;     }      @override     public void onpostexecute(group<venue> venues) {                  ..... //omitted            }      public group<venue> search(int from,int limit) throws anywhereexception, locationexception,             ioexception {          anywhere anywhere = ((anywhered) getapplication()).getanywhere();          location location = ((anywhered) getapplication()).getlastknownlocationorthrow();          nearbyvenues nvs  = anywhere.venues(locationutils                 .createanywherelocation(location), msearchholder.query,from, limit);         group<venue> venues = nvs.getnearybys();          return venues;     } }  venues method call defaulthttpclient execute() method perform request data server. 


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -