static void rename(Context context,String originalFileName,String newFileName){
  File originalFile=context.getFileStreamPath(originalFileName);
  if (originalFile.exists()) {
    Log.d("SavingHelper","renaming " + originalFileName + " size "+ originalFile.length()+ " to "+ newFileName);
    File newFile=new File(originalFile.getParent(),newFileName);
    if (newFile.exists()) {
      context.deleteFile(newFileName);
    }
    originalFile.renameTo(newFile);
  }
}

static void rename ( Context context , String originalFileName , String newFileName ) { File originalFile = context . getFileStreamPath ( originalFileName ) ; if ( originalFile . exists ( ) ) { Log . d ( "SavingHelper" , "renaming " + originalFileName + " size " + originalFile . length ( ) + " to " + newFileName ) ; File newFile = new File ( originalFile . getParent ( ) , newFileName ) ; if ( newFile . exists ( ) ) { context . deleteFile ( newFileName ) ; } originalFile . renameTo ( newFile ) ; } }
rename existing file in same directory if target file exists , delete code nicked from http : / / stackoverflow . com / users / 325442 / mr - bungle
