android多任务下载,并实时显示在多个进度条问题
android多线程断点下载,并实时显示在多个进度条呀,哪位大神做过,急用,求demo,谢谢!QQ:469079745 --------------------编程问答-------------------- 这个我做过啊 --------------------编程问答-------------------- 我博客有,不知道是否满足你的需求 --------------------编程问答--------------------
求demo,大神,发我QQ邮箱:46907745;给你分,谢谢 --------------------编程问答--------------------
UI部分没写,只有多线程下载 --------------------编程问答--------------------
这个我做过啊
求demo,大神,发我QQ邮箱:46907745;给你分,谢谢
UI部分没写,只有多线程下载
是多线程断点续传嘛? --------------------编程问答--------------------
这个我做过啊
求demo,大神,发我QQ邮箱:46907745;给你分,谢谢
UI部分没写,只有多线程下载
是多线程断点续传嘛?
只有多线程,断点?好像有吧 --------------------编程问答--------------------
这个我做过啊
求demo,大神,发我QQ邮箱:46907745;给你分,谢谢
UI部分没写,只有多线程下载
是多线程断点续传嘛?
只有多线程,断点?好像有吧
呵呵……发来看看 --------------------编程问答-------------------- 完美的断点续传需要服务器支持~~~~ --------------------编程问答--------------------
完美的断点续传需要服务器支持~~~~
不是加了这些就可以了吗
HttpURLConnection http = (HttpURLConnection) downUrl.openConnection();--------------------编程问答-------------------- 拿到http文件信息时要判读服务器是否返回了:
http.setConnectTimeout(5 * 1000);
http.setRequestMethod("GET");
http.setRequestProperty("Accept", "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*");
http.setRequestProperty("Accept-Language", "zh-CN");
http.setRequestProperty("Referer", downUrl.toString());
http.setRequestProperty("Charset", "UTF-8");
int startPos = block * (threadId - 1) + downLength;//开始位置
int endPos = block * threadId -1;//结束位置
http.setRequestProperty("Range", "bytes=" + startPos + "-"+ endPos);//设置获取实体数据的范围
http.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)");
http.setRequestProperty("Connection", "Keep-Alive");
InputStream inStream = http.getInputStream();
Accept-Ranges:bytes
只要返回了这个才支持断点续传 --------------------编程问答--------------------
完美的断点续传需要服务器支持~~~~
不是加了这些就可以了吗
HttpURLConnection http = (HttpURLConnection) downUrl.openConnection();
http.setConnectTimeout(5 * 1000);
http.setRequestMethod("GET");
http.setRequestProperty("Accept", "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*");
http.setRequestProperty("Accept-Language", "zh-CN");
http.setRequestProperty("Referer", downUrl.toString());
http.setRequestProperty("Charset", "UTF-8");
int startPos = block * (threadId - 1) + downLength;//开始位置
int endPos = block * threadId -1;//结束位置
http.setRequestProperty("Range", "bytes=" + startPos + "-"+ endPos);//设置获取实体数据的范围
http.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)");
http.setRequestProperty("Connection", "Keep-Alive");
InputStream inStream = http.getInputStream();
http.setRequestProperty("Range", "bytes=" + startPos + "-"+ endPos);应该就是这个需要服务器支持,服务器根据这个头信息处理之后,返回头中带有Accept-Ranges(具体是不是这个属性忘记了),客户端才能根据这个信息进行续传~~~ --------------------编程问答-------------------- 是下载不是上传,好像都可以这样啊
补充:移动开发 , Android