我在 sdcard 上有一个数据库文件,现在当下载一个新的数据库文件时,我需要它来覆盖旧的而不是重命名它,这是我的下载代码。下载代码运行良好..
public void startDownload() {
pDialog = new ProgressDialog(this);
pDialog.setMessage("Downloading Database. Please wait...");
pDialog.setIndeterminate(false);
pDialog.setMax(100);
pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pDialog.setCancelable(false);
Uri uri=Uri.parse(file_url);
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
File ADirectory = new File(baseDir +"/test");
ADirectory.mkdirs();
lastDownload=
mgr.enqueue(new DownloadManager.Request(uri)
.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI |
DownloadManager.Request.NETWORK_MOBILE)
.setAllowedOverRoaming(false)
.setTitle(" Database File")
.setDescription("Please wait....test Database downloading.")
.setDestinationInExternalPublicDir("/test", "/testing"));
pDialog.show();
//v.setEnabled(false);
// findViewById(R.id.query).setEnabled(true);
}