标签:android blog ar for java 文件 数据 2014 art
//采用android sharedpreferences 进行数据的保存读取 SharedPreferences sharedPreferences; private final String mediaShare = "test"; private void InitMediaSharePreference() { sharedPreferences = this.getSharedPreferences(mediaShare, MODE_PRIVATE); } //写入 String mdatStr = String.format("data_%d%d.yourdata", name1, name2); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putInt(mdatStr, startMdatPlace); editor.putString("STRING_KEY", "string"); editor.putBoolean("BOOLEAN_KEY", true); editor.commit(); //查找 int startMdatPlace = sharedPreferences.getInt( String.format("data_%d%d.yourdata", name1, name2), -1); if (startMdatPlace != -1) { //如果文件不存在 } else{ //找到文件,读取 }
标签:android blog ar for java 文件 数据 2014 art
原文地址:http://blog.csdn.net/tanmengwen/article/details/41915091