Skip to content

Index out of bound error  #3

@tapanrgohil

Description

@tapanrgohil

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));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions