yangfuhai / afinal

Afinal是一个android的ioc,orm框架,内置了四大模块功能:FinalAcitivity,FinalBitmap,FinalDb,FinalHttp。通过finalActivity,我们可以通过注解的方式进行绑定ui和事件。通过finalBitmap,我们可以方便的加载bitmap图片,而无需考虑oom等问题。通过finalDB模块,我们一行代码就可以对android的sqlite数据库进行增删改查。通过FinalHttp模块,我们可以以ajax形式请求http数据。详情请通过以下网址查看。
3.15k stars 1.49k forks source link

new AjaxCallBack<File>() onLoading方法不执行,只执行onSuccess方法,什么问题? #92

Closed codingpp closed 6 years ago

codingpp commented 9 years ago

public void onLoading(long count,long current){}; public void onSuccess(T t){}; public void onFailure(Throwable t,int errorNo ,String strMsg){};

bacy commented 9 years ago

你是下载方法吗?文件有多大?

javaDashuaiAndroid commented 9 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));