java - RejectExecutionError while running async tasks in a loop -


i using following code

private void getonlineconnections() {            (int = 0; < contacts.size(); i++)     {         final persons person =  contacts.get(i);         string querystring = null;         try {             querystring = string.format(constants.get_online_url,                                  urlencoder.encode(person.myid, "utf-8"));         } catch (unsupportedencodingexception e) {             e.printstacktrace();         }          responsecallback callback = new responsecallback()          {             @override             public void onsuccess(string response)              {                 response = response.trim();              }              @override             public void onfailure(string exception)              {}         };          new myasynctask(querystring, callback);      }        } 

myasynctask asynctask.

now number of contacts can more 128 or more limit of theadpoolexecutor.

how can increase limit won't crash on rejectexecutionerror.

if using api level 11 or higher, create own thread pool , use executeonexecutor().

if supporting older devices, don't use asynctask. create own thread pool , use other means (e.g., runonuithread()) arrange work done on main application thread.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -