private static int renameInMediaDatabase(Context context,String[] oldPathNames,String... newPathNames){
  if ((oldPathNames != null) && (oldPathNames.length > 0)) {
    if (Global.debugEnabled) {
      Log.i(Global.LOG_CONTEXT,CONTEXT + "renameInMediaDatabase to " + newPathNames.length+ " files "+ newPathNames[0]+ "...");
    }
    Map<String,String> old2NewFileNames=new HashMap<>(oldPathNames.length);
    ArrayList<String> deleteFileNames=new ArrayList<String>();
    ArrayList<String> insertFileNames=new ArrayList<String>();
    for (int i=0; i < oldPathNames.length; i++) {
      String oldPathName=oldPathNames[i];
      String newPathName=newPathNames[i];
      if ((oldPathName != null) && (newPathName != null)) {
        old2NewFileNames.put(oldPathName,newPathName);
      }
 else       if (oldPathName != null) {
        deleteFileNames.add(oldPathName);
      }
 else       if (newPathName != null) {
        insertFileNames.add(newPathName);
      }
    }
    int modifyCount=deleteInMediaDatabase(context,deleteFileNames.toArray(new String[deleteFileNames.size()])) + renameInMediaDatabase(context,old2NewFileNames) + insertIntoMediaDatabase(context,insertFileNames.toArray(new String[insertFileNames.size()]));
    return modifyCount;
  }
  return 0;
}

private static int renameInMediaDatabase ( Context context , String [ ] oldPathNames , String ... newPathNames ) { if ( ( oldPathNames != null ) && ( oldPathNames . length > 0 ) ) { if ( Global . debugEnabled ) { Log . i ( Global . LOG_CONTEXT , CONTEXT + "renameInMediaDatabase to " + newPathNames . length + " files " + newPathNames [ 0 ] + "..." ) ; } Map < String , String > old2NewFileNames = new HashMap < > ( oldPathNames . length ) ; ArrayList < String > deleteFileNames = new ArrayList < String > ( ) ; ArrayList < String > insertFileNames = new ArrayList < String > ( ) ; for ( int i = 0 ; i < oldPathNames . length ; i ++ ) { String oldPathName = oldPathNames [ i ] ; String newPathName = newPathNames [ i ] ; if ( ( oldPathName != null ) && ( newPathName != null ) ) { old2NewFileNames . put ( oldPathName , newPathName ) ; } else if ( oldPathName != null ) { deleteFileNames . add ( oldPathName ) ; } else if ( newPathName != null ) { insertFileNames . add ( newPathName ) ; } } int modifyCount = deleteInMediaDatabase ( context , deleteFileNames . toArray ( new String [ deleteFileNames . size ( ) ] ) ) + renameInMediaDatabase ( context , old2NewFileNames ) + insertIntoMediaDatabase ( context , insertFileNames . toArray ( new String [ insertFileNames . size ( ) ] ) ) ; return modifyCount ; } return 0 ; }
change path and path dependant fields in media database
