Android 存储

private SharedPreferences sf;
sf = TeLoginActivity.this.getSharedPreferences("basic_info", Context.MODE_PRIVATE);

editor = sf.edit();

                if (isSavePwd) {
                    editor.putString("username", userEdit.getText().toString());
                    editor.putString("password", pwdEdit.getText().toString());
                    editor.putBoolean("isNeedVoluntaryLogin", true);

editor.commit();


sf = TeLoginActivity.this.getSharedPreferences(Constants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE);
                editor = sf.edit();
                editor.remove("xmpp_host");
                editor.putString("xmpp_host", Constants.PUSH_SERVER_IP);
                editor.commit();

String name = sf.getString("username", "");

 

posted @ 2013-06-04 08:43  double0zhou  阅读(148)  评论(0编辑  收藏  举报