Multiple file download manager in listview +progress/pause/resume android

Saeid picture Saeid · May 18, 2014 · Viewed 11k times · Source

i need to make a dynamic download manager for my app in this form :

  1. adding new link to current list
  2. can pause and resume download
  3. deleting complete downloads from custom list

    like this pic:

at first i use this site code for thread downloading.

then , i make a custom list view that Every time user click on the Download button,that download link Will be added.

But i have two problem :

  1. after adding new link to list , all of list will be New!
  2. too, previous unfinished download(s) will be new , as list will be new!

Now , The question is: how i can make a dynamic download manager for my app that , can adding new link to list with pause/resume ability and remove downloaded item from custom list?


Edit - adding Custom-Listview

my custom list-view in this link : https://github.com/saeid-pm/Custom-Listview

Answer

Saeid picture Saeid · Jul 27, 2015

finally after about 1years(:D) this is one of best solutions :

using this library by add to project with library ,

or with Android Studio dependencies :

 dependencies {
    compile 'com.mani:ThinDownloadManager:1.3.0'
 }

it's one of best and fast (any) file Download library , Too is so simple to use and customize.

for example in my question(in 1 year ago) that i wanted to have Multiple-File-Download , at ease can specify thread pool size by :

ThinDownloadManager downloadManager = new ThinDownloadManager(DOWNLOAD_THREAD_POOL_SIZE); 

//DOWNLOAD_THREAD_POOL_SIZE = number of threads.

goodLuck!.


Edit for answer to @Bhuvi , (set destination downloaded file)

  1. Define file destination :

            String fileName ="file name";
            File root = android.os.Environment.getExternalStorageDirectory();
            File dir = new File(root.getAbsolutePath() +`subfolder name`);
    
            if (dir.exists() == false) {
                dir.mkdirs();
            }
    
            final Uri destinationUri = Uri.parse(dir + fileName);
    
  2. then setDestinationURI(your path) for ThinDownloadManager

    downloadRequest = 
      new DownloadRequest(downloadUri)setDestinationURI(destinationUri).setPriority(DownloadRequest.Priority.HIGH)
    

Edit @farhad.kargaran answer - 2017/12/06

as i saw ThinDownloadManager repository , last version is 1.3.0 but According to @farhad.kargaran answer there are version 1.4.0 too , i have not tested new version's features ,but you can also test the new version according to @farhad.kargaran's answer.