下载Android中使用下载管理器类的多个文件?多个、管理器、文件、Android

由网友(碍你至深)分享简介:我想用下载管理器类的android我有100-200图像文件,但是当我尝试下载文件,应用程序崩溃,但下载开始下载多个文件?我该如何解决这个问题,我的$ C $下下载的文件是:i want to download multiple files using downloadmanager class in androi...

我想用下载管理器类的android我有100-200图像文件,但是当我尝试下载文件,应用程序崩溃,但下载开始下载多个文件? 我该如何解决这个问题,我的$ C $下下载的文件是:

i want to download multiple files using downloadmanager class in android i have 100-200 image file but when i try to download the files app crashes but the download starts? how can i fix this,my code for downloading the files is:

public void downloadimages(String url,String filename)
        {
          String ur1=url,v1=filename;
          downloadManager = (DownloadManager)getSystemService(DOWNLOAD_SERVICE);
          Uri Download_Uri = Uri.parse(ur1);
          DownloadManager.Request request = new DownloadManager.Request(Download_Uri);
          request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
          request.setAllowedOverRoaming(false);
          request.setDescription("Android Data download using DownloadManager.");
          request.setDestinationInExternalFilesDir(getApplicationContext(),Environment.DIRECTORY_DOWNLOADS,v1 + ".jpg");
          downloadManager.enqueue(request);     

        }
02-23 16:45:28.695: E/AndroidRuntime(22646): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.newpicker/com.example.newpicker.AnotherActivity}: java.lang.IndexOutOfBoundsException: Invalid index 136, size is 136

这是我的logcat

this is my logcat

推荐答案

您可以向我们展示了code com.example.newpicker.AnotherActivity 类,因为它看来,错误来自这个班。

Can you show us the code com.example.newpicker.AnotherActivity class, because it seems that the error comes from this class.

那么错误是 IndexOutOfBoundsException异常,让你尝试用更少的图像,例如10或20?并在以后执行时的第一个10被回收?

then the error is a IndexOutOfBoundsException, so have you tried with less image eg 10 or 20? and run later when the first 10 are recovered?

阅读全文

相关推荐

最新文章