@Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (buttonView == cbRemPwd) { PreferenceHelper.getHelper(getContext()) .writePreference(PRE_KEY_REM_PWD_CHECKED, "" + isChecked); } }
private void initElements() { etPassword = (EditText) findViewById(R.id.et_password); spUsername = (EditText) findViewById(R.id.sp_username); // spUsername.setOnItemSelectedListener(this); cbRemPwd = (CheckBox) findViewById(R.id.cb_rem_pwd); String remPwd = PreferenceHelper.getHelper(getContext()).readPreference(PRE_KEY_REM_PWD_CHECKED); if (remPwd != null && Boolean.valueOf(remPwd)) { cbRemPwd.setChecked(true); } cbRemPwd.setOnCheckedChangeListener(this); }