Код: Выделить всё
mBool = mPrefs.getBoolean("buttondefault", true);
Boolean b = mBool; //Only creating this for Logging, mBool IS PRIMITIVE
Log.e("Update pref", b.toString());
mToggle = (ToggleButton)findViewById(R.id.ac_toggle);
mToggle.setOnClickListener(this);
mToggle.setChecked(mBool);
Вот XML-файл для кнопки:
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/802 ... -of-button
Мобильная версия