Trying to make settings. Actually I save settings in sharedPreference. The problem is that it strangely keeps the Boolean: I’ll go into the settings, checkbox is all false, I’m re-entering everything true. What's my mistake?

/*НАСТРОЙКИ+СОХРАНЕНИЕ ИНФЫ*/ public static final String CHECK_SETTINGS = "check_settings"; //Имя файла //Обучение public static final String hasWathed="false"; // проверка на просмотр обучения public static final String notifShops="true"; // уведомления магазинов public static final String notifWebSite="true"; // уведомления сайта 

Dialog:

  final CharSequence[] items = {" Получать уведомления об обновлениях сайта "," Получать уведомления об акциях магазинов "}; sp = getSharedPreferences(CHECK_SETTINGS, Context.MODE_PRIVATE); boolean shops = sp.getBoolean(notifShops, true); boolean webSite = sp.getBoolean(notifWebSite, true); boolean[] mCheckedItems={webSite,shops}; AlertDialog dialog = new AlertDialog.Builder(this) .setTitle("Настройки") .setMultiChoiceItems(items, mCheckedItems, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) { if(indexSelected==0){ Log.d("Settings","notifWebSite"+isChecked); SharedPreferences.Editor e = sp.edit(); e.putBoolean(notifWebSite, isChecked); e.commit(); // не забудьте подтвердить изменения } if(indexSelected==1){ Log.d("Settings","notifShops"+isChecked); SharedPreferences.Editor e = sp.edit(); e.putBoolean(notifShops, isChecked); e.commit(); // не забудьте подтвердить изменения } } }).setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // Your code when user clicked on OK // You can write the code to save the selected item here } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // Your code when user clicked on Cancel dialog.cancel(); } }).create(); dialog.show(); 

    0