public void saveRecording(Context context,String newName){
  Log.d(TAG,">> saveRecording(" + newName + ")");
  if (null == mRecordFile) {
    Log.e(TAG,"<< saveRecording: recording file is null!");
    return;
  }
  File parentFile=mRecordFile.getParentFile();
  if (null == parentFile) {
    Log.e(TAG,"<< saveRecording: parent recording file is null!");
    return;
  }
  if (null != newName && !newName.equals(getRecordingName())) {
    File sdFile=new File(parentFile.getPath(),newName + RECORDING_FILE_EXTENSION);
    if (sdFile.exists()) {
      Log.w(TAG,"A file with the same new name will be deleted: " + sdFile.getAbsolutePath());
      if (!sdFile.delete()) {
        Log.e(TAG,"can't delete the file already exits");
      }
    }
    if (null != parentFile) {
      if (!mRecordFile.renameTo(new File(parentFile.getPath(),newName + RECORDING_FILE_EXTENSION))) {
        Log.e(TAG,"can't rename file, use default name to save");
        newName=getRecordingName();
      }
      mRecordFile=new File(parentFile.getPath(),newName + RECORDING_FILE_EXTENSION);
    }
  }
  mIsRecordingFileSaved=true;
  addCurrentRecordingToDb(context);
  Log.d(TAG,"<< saveRecording(" + newName + ")");
}

public void saveRecording ( Context context , String newName ) { Log . d ( TAG , ">> saveRecording(" + newName + ")" ) ; if ( null == mRecordFile ) { Log . e ( TAG , "<< saveRecording: recording file is null!" ) ; return ; } File parentFile = mRecordFile . getParentFile ( ) ; if ( null == parentFile ) { Log . e ( TAG , "<< saveRecording: parent recording file is null!" ) ; return ; } if ( null != newName && ! newName . equals ( getRecordingName ( ) ) ) { File sdFile = new File ( parentFile . getPath ( ) , newName + RECORDING_FILE_EXTENSION ) ; if ( sdFile . exists ( ) ) { Log . w ( TAG , "A file with the same new name will be deleted: " + sdFile . getAbsolutePath ( ) ) ; if ( ! sdFile . delete ( ) ) { Log . e ( TAG , "can't delete the file already exits" ) ; } } if ( null != parentFile ) { if ( ! mRecordFile . renameTo ( new File ( parentFile . getPath ( ) , newName + RECORDING_FILE_EXTENSION ) ) ) { Log . e ( TAG , "can't rename file, use default name to save" ) ; newName = getRecordingName ( ) ; } mRecordFile = new File ( parentFile . getPath ( ) , newName + RECORDING_FILE_EXTENSION ) ; } } mIsRecordingFileSaved = true ; addCurrentRecordingToDb ( context ) ; Log . d ( TAG , "<< saveRecording(" + newName + ")" ) ; }
save recording with the given name , and save recording file info to database
