1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| String filename = url.substring(url.lastIndexOf("/")); String localPath = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES) + filename; RestVolleyDownload.download(context, url, localPath, new RestVolleyDownload.OnDownloadListener() { @Override public void onDownloadStart(String url) {
}
@Override public void onDownloadSuccess(String url, File file, int httpCode, Headers headers) { ToastUtils.shortToast("保存成功,文件地址:" + localPath); }
@Override public void onDownloadFailure(String url, Exception e, int httpCode, Headers headers) { ToastUtils.shortToast("保存失败"); }
@Override public void onDownloadProgress(String url, int downloadBytes, int contentLength, File file, int httpCode, Headers headers) {
} });
|