@Override public void onDialogClosed(boolean positiveResult) { if (positiveResult) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); sharedPreferences .edit() .putString("col_count", widthPicker.getValue() + "") .putString("row_count", heightPicker.getValue() + "") .commit(); } }