Use Android-query to download and save files locally ., Android image saved locally

Source: Internet
Author: User

Use Android-query to download and save files locally ., Android image saved locally

The entire project uses the Android-query framework.

You need to download the file.

Essay: it facilitates the next search and use.

Only official documents are copied.

 

File
String url = "https://picasaweb.google.com/data/feed/base/featured?max-results=8";              

aq.progress(R.id.progress).ajax(url, File.class, new AjaxCallback<File>(){
       
        public void callback(String url, File file, AjaxStatus status) {
               
                if(file != null){
                        showResult("File:" + file.length() + ":" + file, status);
                }else{
                        showResult("Failed", status);
                }
        }
       
});





File Download

If you can specify where to store the downloaded file with the download () method. Note that these files will not be deleted like cached files.

String url = "https://picasaweb.google.com/data/feed/base/featured?max-results=16";             

File ext = Environment.getExternalStorageDirectory();
File target = new File(ext, "aquery/myfolder/photos.xml");              

aq.progress(R.id.progress).download(url, target, new AjaxCallback<File>(){
       
        public void callback(String url, File file, AjaxStatus status) {
               
                if(file != null){
                        showResult("File:" + file.length() + ":" + file, status);
                }else{
                        showResult("Failed", status);
                }
        }
       
});

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.