0

I Am Ussuing AQuery And Tring To Use This Library To Dowbload Files but i dont understand how to use it.

Thats Sample Code , But I Don't Understand It.

aq.download(String url, File target, Object handler, String callback)

How To Derfine "Object handler" and "String callback" ?

Hossein Kurd
  • 3,184
  • 3
  • 41
  • 71

1 Answers1

0

You can try this way

        File ext = Environment.getExternalStorageDirectory();
        File target = new File(ext, "image/test.jpg");              

        aq.download(imageURL, target, new AjaxCallback<File>(){
            public void callback(String url, File file, AjaxStatus status) {
                if(file != null){
                    Toast.makeText(getApplicationContext(), "File:" + file.length() + ":" +file+"-"+status, 
                            Toast.LENGTH_LONG).show();
                }else{
                    Toast.makeText(getApplicationContext(), "Download Failed", Toast.LENGTH_LONG).show();
                }
            }

        });
Mari_Yaguchi
  • 477
  • 8
  • 25