-
Notifications
You must be signed in to change notification settings - Fork 36
Description
java.lang.IndexOutOfBoundsException: Invalid index 9, size is 9 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at com.krishna.fileloader.MultiFileDownloadTask.onProgressUpdate(MultiFileDownloadTask.java:63) at com.krishna.fileloader.MultiFileDownloadTask.onProgressUpdate(MultiFileDownloadTask.java:20) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:648) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5653) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) at dalvik.system.NativeStart.main(Native Method)
here is my code
downloader.progressListener(new MultiFileDownloadListener() {
@Override
public void onProgress(File downloadedFile, int progress, int totalFiles) {
try {
FileUtils.copyFile(downloadedFile.getAbsoluteFile(), new File(file, downloadedFile.getName()));
Log.d(TAG, "onProgress() called with: downloadedFile = [" + downloadedFile + "], progress = [" + progress + "], totalFiles = [" + totalFiles + "]");
if (progress == totalFiles) {
isSuccess = true;
isFinished = true;
sendIntent(groupId,false);
}
} catch (IOException e) {
e.printStackTrace();
noOferror++;
if (noOferror == imageArray.length)
isFinished = true;
sendIntent(groupId,false);
}
}
@Override
public void onError(Exception e, int progress) {
super.onError(e, progress);
Log.e(TAG, "onError: ", e);
noOferror++;
if (noOferror >= imageArray.length)
isFinished = true;
sendIntent(groupId,false);
}
}).loadMultiple(imageList.toArray(imageArray));