Closed codingpp closed 6 years ago
你是下载方法吗?文件有多大?
dHttp.download(
"http://yinyueshiting.baidu.com/data2/music/124383790/124380645248400128.mp3?xcode=2f36611e0d3ba556dd6ee9dbca2422d52f7167fd0a01384c",
DFileUtil.getExternalStorageDirectory() + "/congcongnanian.mp3",
new AjaxCallBack
public void onSuccess(File t) {
Toast.makeText(DHttpActivity.this,
"歌曲下载完成,路径是" + t.getAbsolutePath(),
Toast.LENGTH_SHORT).show();
};
public void onLoading(long count, long current) {
textView.setText("正在下载: "
+ (int) (((float) (current * 1.0) / count * 1.0) * 100)
+ " %");
};
public void onFailure(Throwable t, int errorNo,
String strMsg) {
t.printStackTrace();
Toast.makeText(DHttpActivity.this, "歌曲下载失败",
Toast.LENGTH_SHORT).show();
};
}.progress(true, 1000));
.progress(true, 1000));
public void onLoading(long count,long current){}; public void onSuccess(T t){}; public void onFailure(Throwable t,int errorNo ,String strMsg){};