AsyncTask not working with arrays (android) -


i want asynctask download multiple files array. using code asynctask works once , ignore rest of array.

private class downloadfiles extends asynctask<string[], integer, string> {          @override          protected string doinbackground(string[]... surl) {               (int p = 0; p < surl.length; p++) {                  (int i=0;i<surl[p].length;i++) {                      getfiletodown(surl[p][i]);                  }              } 

for example want send more array:

   downloadfiles.execute(databasesarray,imagesarray,etc); 

you need not declare string[] generic parameter, string:

asynctask<string, integer, string> 

doinbackground(string... surl) default expects array of type parameter.

also, ... called varargs, , represents array of optional arguments.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -