private void refreshShiftsPreferences() { // Create default shifts if preferences are empty SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); mCustomShifts = prefs.getString("shifts", ""); if (mCustomShifts.equals("")) { SharedPreferences.Editor editor1 = prefs.edit(); editor1.putString("shifts", DEFAULT_SHIFTS); editor1.commit(); mCustomShifts = DEFAULT_SHIFTS; } mShiftList = Shift.parse(mCustomShifts); mShiftTable = new Hashtable<String, Shift>(); changeItems = new CharSequence[mShiftList.size()]; int i = 0; dialogItems = new ArrayList<String>(); String itemRow; for (Shift s : mShiftList) { itemRow = s.getAbbreviation() + " (" + s.getName() + ")"; changeItems[i++] = itemRow; dialogItems.add(itemRow); mShiftTable.put(s.getAbbreviation(), s); } dialogItems.add(getString(R.string.overtime_set)); dialogItems.add(getString(R.string.daily_notes)); }