Java tutorial
//package com.java2s; import android.util.Log; import java.io.File; public class Main { static File rename(File file, String newName) { File newFile = new File(file.getParent(), newName); if (!newFile.equals(file)) { if (newFile.exists()) { if (newFile.delete()) { Log.d("FileUtil", "Delete old " + newName + " file"); } } if (file.renameTo(newFile)) { Log.d("FileUtil", "Rename file to " + newName); } } return newFile; } }