x.http().get(params, new Callback.ProgressCallback<File>() {
@Override
public void onSuccess(File result) {
Log.d("zw---","sucess"); } @Override
public void onError(Throwable ex, boolean isOnCallback) {
Log.d("error===",ex.getMessage());
} @Override
public void onCancelled(CancelledException cex) {
Log.d("zw---","cancle"); } @Override
public void onFinished() {
Log.d("zw---","finish"); } //网络请求之前回调
@Override
public void onWaiting() {
Log.d("zw---","waitting"); } //网络请求开始的时候回调
@Override
public void onStarted() {
Log.d("zw---","start"); } //下载的时候不断回调的方法
@Override
public void onLoading(long total, long current, boolean isDownloading) {
if(isDownloading){
Log.d("zw---","load"+current); //当前进度和文件总大小
Log.i("JAVA", "current:" + current + ",total:" + total);
}else {
Log.d("zw---","load"+isDownloading);
}
}
============AS 控制台Log信息===================
08-15 16:51:56.404 24055-24055/com.example.zw_pc.xutilsdemo D/zw--: begin
08-15 16:51:56.435 24055-24055/com.example.zw_pc.xutilsdemo D/zw---: waitting
08-15 16:51:56.435 24055-24055/com.example.zw_pc.xutilsdemo D/zw---: start
08-15 16:51:56.538 24055-24132/com.example.zw_pc.xutilsdemo I/DpmTcmClient: RegisterTcmMonitor from: com.android.okhttp.TcmIdleTimerMonitor
08-15 16:52:01.839 24055-24055/com.example.zw_pc.xutilsdemo D/zw---: sucess
08-15 16:52:01.841 24055-24055/com.example.zw_pc.xutilsdemo D/zw---: finish
@Override
public void onSuccess(File result) {
Log.d("zw---","sucess"); } @Override
public void onError(Throwable ex, boolean isOnCallback) {
Log.d("error===",ex.getMessage());
} @Override
public void onCancelled(CancelledException cex) {
Log.d("zw---","cancle"); } @Override
public void onFinished() {
Log.d("zw---","finish"); } //网络请求之前回调
@Override
public void onWaiting() {
Log.d("zw---","waitting"); } //网络请求开始的时候回调
@Override
public void onStarted() {
Log.d("zw---","start"); } //下载的时候不断回调的方法
@Override
public void onLoading(long total, long current, boolean isDownloading) {
if(isDownloading){
Log.d("zw---","load"+current); //当前进度和文件总大小
Log.i("JAVA", "current:" + current + ",total:" + total);
}else {
Log.d("zw---","load"+isDownloading);
}
}
============AS 控制台Log信息===================
08-15 16:51:56.404 24055-24055/com.example.zw_pc.xutilsdemo D/zw--: begin
08-15 16:51:56.435 24055-24055/com.example.zw_pc.xutilsdemo D/zw---: waitting
08-15 16:51:56.435 24055-24055/com.example.zw_pc.xutilsdemo D/zw---: start
08-15 16:51:56.538 24055-24132/com.example.zw_pc.xutilsdemo I/DpmTcmClient: RegisterTcmMonitor from: com.android.okhttp.TcmIdleTimerMonitor
08-15 16:52:01.839 24055-24055/com.example.zw_pc.xutilsdemo D/zw---: sucess
08-15 16:52:01.841 24055-24055/com.example.zw_pc.xutilsdemo D/zw---: finish
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货