public void addCurrentRecordingToDb(final Context context){
  Log.v(TAG,">> addCurrentRecordingToDb");
  if (null == mRecordFile || !mRecordFile.exists()) {
    Log.e(TAG,"<< addCurrentRecordingToDb: file does not exists");
    return;
  }
  long curTime=System.currentTimeMillis();
  long modDate=mRecordFile.lastModified();
  Date date=new Date(curTime);
  String title=getRecordingName();
  final int size=8;
  ContentValues cv=new ContentValues(size);
  cv.put(MediaStore.Audio.Media.IS_MUSIC,1);
  cv.put(MediaStore.Audio.Media.TITLE,title);
  cv.put(MediaStore.Audio.Media.DATA,mRecordFile.getAbsolutePath());
  final int oneSecond=1000;
  cv.put(MediaStore.Audio.Media.DATE_ADDED,(int)(curTime / oneSecond));
  cv.put(MediaStore.Audio.Media.DATE_MODIFIED,(int)(modDate / oneSecond));
  cv.put(MediaStore.Audio.Media.MIME_TYPE,RECORDING_FILE_TYPE);
  cv.put(MediaStore.Audio.Media.ALBUM,RECORDING_FILE_SOURCE);
  cv.put(MediaStore.Audio.Media.DURATION,mRecordTime);
  int recordingId=addToMediaDB(context,cv);
  if (-1 == recordingId) {
    return;
  }
  int playlistId=getPlaylistId(context);
  if (-1 == playlistId) {
    playlistId=createPlaylist(context);
  }
  if (-1 == playlistId) {
    return;
  }
  addToPlaylist(context,playlistId,recordingId);
  MediaScannerConnection.scanFile(context,new String[]{mRecordFile.getAbsolutePath()},null,null);
}

public void addCurrentRecordingToDb ( final Context context ) { Log . v ( TAG , ">> addCurrentRecordingToDb" ) ; if ( null == mRecordFile || ! mRecordFile . exists ( ) ) { Log . e ( TAG , "<< addCurrentRecordingToDb: file does not exists" ) ; return ; } long curTime = System . currentTimeMillis ( ) ; long modDate = mRecordFile . lastModified ( ) ; Date date = new Date ( curTime ) ; String title = getRecordingName ( ) ; final int size = 8 ; ContentValues cv = new ContentValues ( size ) ; cv . put ( MediaStore . Audio . Media . IS_MUSIC , 1 ) ; cv . put ( MediaStore . Audio . Media . TITLE , title ) ; cv . put ( MediaStore . Audio . Media . DATA , mRecordFile . getAbsolutePath ( ) ) ; final int oneSecond = 1000 ; cv . put ( MediaStore . Audio . Media . DATE_ADDED , ( int ) ( curTime / oneSecond ) ) ; cv . put ( MediaStore . Audio . Media . DATE_MODIFIED , ( int ) ( modDate / oneSecond ) ) ; cv . put ( MediaStore . Audio . Media . MIME_TYPE , RECORDING_FILE_TYPE ) ; cv . put ( MediaStore . Audio . Media . ALBUM , RECORDING_FILE_SOURCE ) ; cv . put ( MediaStore . Audio . Media . DURATION , mRecordTime ) ; int recordingId = addToMediaDB ( context , cv ) ; if ( - 1 == recordingId ) { return ; } int playlistId = getPlaylistId ( context ) ; if ( - 1 == playlistId ) { playlistId = createPlaylist ( context ) ; } if ( - 1 == playlistId ) { return ; } addToPlaylist ( context , playlistId , recordingId ) ; MediaScannerConnection . scanFile ( context , new String [ ] { mRecordFile . getAbsolutePath ( ) } , null , null ) ; }
save recording file info to database
