android SharedFerence使用

写入数据

     SharedPreferences store = getSharedPreferences("storexml", 0);
     SharedPreferences.Editor editor = store.edit();
     editor.putString("test", text.getText().toString());
     editor.commit();

 

 

读取数据

        SharedPreferences store = getSharedPreferences("storexml", 0);
        str = store.getString("test", "");
        text.setText(str);

你可能感兴趣的:(android)