I have a database file which is on the sdcard and now when a new database file is downloaded i need it to overwrite the old one instead of renaming it here is my downloading
when you're submitting the file to the download manager check if the file already exists. then delete it.
private boolean isFileExists(String filename){
File folder1 = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + filename);
return folder1.exists();
}
private boolean deleteFile( String filename){
File folder1 = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + filename);
return folder1.delete();
}