i need to make a dynamic download manager for my app in this form :
deleting complete downloads from custom list
like this
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 :
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
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)
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);
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With