public static Uri renameScrapFile(String fileExtension,String uniqueIdentifier,Context context){
  String filePath=getScrapPath(context);
  if (uniqueIdentifier == null) {
    uniqueIdentifier="";
  }
  File newTempFile=new File(getScrapPath(context,".temp" + uniqueIdentifier + fileExtension));
  File oldTempFile=new File(filePath);
  boolean deleted=newTempFile.delete();
  if (!oldTempFile.renameTo(newTempFile)) {
    return null;
  }
  return Uri.fromFile(newTempFile);
}

public static Uri renameScrapFile ( String fileExtension , String uniqueIdentifier , Context context ) { String filePath = getScrapPath ( context ) ; if ( uniqueIdentifier == null ) { uniqueIdentifier = "" ; } File newTempFile = new File ( getScrapPath ( context , ".temp" + uniqueIdentifier + fileExtension ) ) ; File oldTempFile = new File ( filePath ) ; boolean deleted = newTempFile . delete ( ) ; if ( ! oldTempFile . renameTo ( newTempFile ) ) { return null ; } return Uri . fromFile ( newTempFile ) ; }
renamescrapfile renames the single scrap file to a new name so newer uses of the scrap file won ' t overwrite the previously captured data .
