介于整个项目利用的是Android-query框架。
需要实现文件的下载。
随笔:方便下次的查找和使用。
只进行了官方文档的拷贝。
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); } } });
时间: 2024-10-07 13:37:41