public void click(View v){
//【1】获取下载路径
String path = et_path.getText().toString().trim();
//【2】创建HttpUtils对象
HttpUtils http = new HttpUtils();
//【3】实现断点下载
http.download(path, "/data/data/activitytest.example.com.kydown/QQ.exe", true, new RequestCallBack<File>() {
@Override
public void onSuccess(ResponseInfo<File> responseInfo) {
Toast.makeText(MainActivity.this,"下载成功",Toast.LENGTH_SHORT).show();
}
@Override
public void onLoading(long total, long current, boolean isUploading) {
pb.setMax((int) total);
pb.setProgress((int) current);
}
@Override
public void onFailure(HttpException error, String msg) {
Toast.makeText(MainActivity.this,"下载失败",Toast.LENGTH_SHORT).show();
}
});
}