matsuhiro / androiddownloadmanger Goto Github PK
View Code? Open in Web Editor NEWdownload manger for Android
download manger for Android
Hi.
I'm trying to use your library.
So far so good.
But I'm not able to start multiple downloads at the same time.
In my situation, I have a listview and an OnItemClickListener()
.
Then, onItemClick
, I launch the download (I modified DownloadTask
to accept the destination filename) with:
try {
DownloadTask dt = new DownloadTask(
this, linkString, filename, pathString, myDownloadTaskListener);
dt.execute();
} catch (MalformedURLException e) {
e.printStackTrace();
}
While done quickly on multiple items, downloads seems to start in sequence anyway.
Do you have any hint?
Thanks.
EDIT: It came out that the solution is executing the AsyncTask
with:
dt.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
Now I have to find a way to keep track of the different thread IDs for your DownloadTaskListener()
.
EDIT 2: I used some maps to link every progress to different IDs, i.e.: Map<Long, Integer> mDownloadPercentMap = new HashMap<Long, Integer>();
and then in DownloadTask#onProgressUpdate
:
mDownloadPercent = (int) ((mDownloadSize + mPreviousFileSize) * 100 / mTotalSize);
Maps.mDownloadPercentMap.put(mThreadId, mDownloadPercent);
Next goal: find out how to cancel a specific download (since more than one may be running at the same time).
EDIT 3: Ok, I've done this too. Anyway I'll close here to stop spamming your Issues ;) and post my forked version.
Thanks.
Please add option to change queue order and automatic retry in youtube downloader.
Hi matsuhiro,
I wanted to ask for some documentation about this library usage, but in the mean time I'm finding my way and I have to say that it's really amazing!
May I briefly ask if "pause / resume" for downloads is implemented?
thanks.
mPreviousFileSize = mTempFile.length();
とか
int length = mPreviousFileSize + mConnection.getContentLength();
とか
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.