변수 선언
private final String USER_PREFERENCE = "Preference";
private final SharedPreferences preference;
생성자 또는 onCreate에 정의
LayoutSwitcher_pref = mContext.getSharedPreferences(USER_PREFERENCE, 0);
저장하고 불러오는 방법
private void savePreference(){
final SharedPreferences.Editor editor = this.preference.edit();
editor.putFloat("variable",this.sensorSensitive); // Key 값 variable, 해당변수 값
editor.commit();//성공시 true값
}//end setPreference Method
private void settingPreference(){
Log.d("hoon","settingPreference");
this.sensorSensitive = this.preference.getFloat("variable",5); // Key 값 variable,초기값
(없을 경우를 대비하여)
}//end settingPreference