Source:
<code>public static void changeExternalPrivateCgeoDir(final SettingsActivity fromActivity, final String newExtDir) { final Progress progress = new Progress(true); <START> final Resources res = fromActivity.getResources(); <END> progress.show(fromActivity, res.getString(R.string.init_datadirmove_datadirmove), res.getString(R.string.init_datadirmove_running), ProgressDialog.STYLE_HORIZONTAL, null); AndroidRxUtils.bindActivity(fromActivity, Observable.defer(new Callable<Observable<Boolean>>() { @Override public Observable<Boolean> call() { final File newDataDir = new File(newExtDir, GEOCACHE_DATA_DIR_NAME); final File currentDataDir = new File(getExternalPrivateCgeoDirectory(), GEOCACHE_DATA_DIR_NAME); Log.i("Moving geocache data to " + newDataDir.getAbsolutePath()); final File[] files = currentDataDir.listFiles(); progress.setMaxProgressAndReset(files.length); progress.setProgress(0); for (final File geocacheDataDir : files) { FileUtils.moveTo(geocacheDataDir, newDataDir); progress.incrementProgressBy(1); } Settings.setExternalPrivateCgeoDirectory(newExtDir); Log.i("Ext private c:geo dir was moved to " + newExtDir); externalPrivateCgeoDirectory = new File(newExtDir); return Observable.just(true); } }).subscribeOn(Schedulers.io())).subscribe(new Consumer<Boolean>() { @Override public void accept(final Boolean success) { progress.dismiss(); final String message = success ? fromActivity.getString(R.string.init_datadirmove_success) : fromActivity.getString(R.string.init_datadirmove_failed); Dialogs.message(fromActivity, R.string.init_datadirmove_datadirmove, message); } }); }</code><technical_language>Is res needed here? fromActivity.getString( ) get instead</technical_language>

Target:
public static void changeExternalPrivateCgeoDir(final SettingsActivity fromActivity, final String newExtDir) { final Progress progress = new Progress(true); progress.show(fromActivity, fromActivity.getString(R.string.init_datadirmove_datadirmove), fromActivity.getString(R.string.init_datadirmove_running), ProgressDialog.STYLE_HORIZONTAL, null); AndroidRxUtils.bindActivity(fromActivity, Observable.defer(new Callable<Observable<Boolean>>() { @Override public Observable<Boolean> call() { final File newDataDir = new File(newExtDir, GEOCACHE_DATA_DIR_NAME); final File currentDataDir = new File(getExternalPrivateCgeoDirectory(), GEOCACHE_DATA_DIR_NAME); Log.i("Moving geocache data to " + newDataDir.getAbsolutePath()); final File[] files = currentDataDir.listFiles(); progress.setMaxProgressAndReset(files.length); progress.setProgress(0); for (final File geocacheDataDir : files) { FileUtils.moveTo(geocacheDataDir, newDataDir); progress.incrementProgressBy(1); } Settings.setExternalPrivateCgeoDirectory(newExtDir); Log.i("Ext private c:geo dir was moved to " + newExtDir); externalPrivateCgeoDirectory = new File(newExtDir); return Observable.just(true); } }).subscribeOn(Schedulers.io())).subscribe(new Consumer<Boolean>() { @Override public void accept(final Boolean success) { progress.dismiss(); final String message = success ? fromActivity.getString(R.string.init_datadirmove_success) : fromActivity.getString(R.string.init_datadirmove_failed); Dialogs.message(fromActivity, R.string.init_datadirmove_datadirmove, message); } }); }