標籤:
介於整個項目利用的是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);
}
}
});
利用Android-query實現檔案下載、儲存在本地。