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
Post a Comment