一、保存数据
SharedPreferences sp = getSharedPreferences("NumberAddressConfig", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.putString("yourphone", myourphone);
editor.putString("youraddress", myouraddress);
editor.putString("yourshowregion", mshowregion);
editor.putString("yourshowname", mshowname);
editor.commit();
二、读数据
SharedPreferences msp_read = getSharedPreferences("NumberAddressConfig", Context.MODE_PRIVATE);
yourshowregion = msp_read.getString("yourshowregion", "xxx");
yourshowname = msp_read.getString("yourshowname", "xxxx");
?三、参考文章
10) 十分钟学会android--app数据保存三种方式 - 陈程编程 - 博客园
|