I'm getting the links to the files using this code:
private List<String> getFilesList(String path, String idcity){
List<String> files = new ArrayList<String>();
String readJSON = readJSON(path,idcity);
try {
JSONArray jsonArray = new JSONArray(readJSON);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
files.add(jsonObject.getString("file"));
}
} catch (Exception e) {
Log.e("getFilesList", "Error parsing data ", e);
}
return files;
}
Now I want to download all this files to SDCard.
I think that this can be achieved using AsyncTask (and show a ProgressDialog with the information of how many files are left to download).
I'm using Android API 4, so I can't use DownloadManager.
Can you guys provide me some code, assuming that the links are in a List<String>
?
Thanks in advance!