键值对存储、撤销存储密码

道理很简单 , 当确定保存的时候,SP名字设置为 remember + 帐号, 对应的值设置为密码 。取消保存的时候设置为空就好

            if (rememberPassword) {
                configSE.putString(AppConstant.SP_REMEMBERPASSWORD + phoneNum, password);
            }else{
                configSE.putString(AppConstant.SP_REMEMBERPASSWORD + phoneNum, "");
            }

 

那如何在输入的时候判断?Textwatcher! 

 

ps. edittext也可以设置,  (twPassword 是textwatcher对象

 passwordet.addTextChangedListener(twPassword);

 

TextWatcher中有三个方法,那这个方法可以写在afterTextChanged中

 passwordet.setText(configSP.getString(AppConstant.SP_REMEMBERPASSWORD + s.toString(), ""));

 

posted @ 2016-10-19 18:15  Lyxin_c  阅读(307)  评论(0编辑  收藏  举报