장삼의 착한코딩

[Android] Sharedpreference 본문

Android

[Android] Sharedpreference

wkdgusdn3 2015. 12. 30. 17:22
데이터 저장
SharedPreferences sharedPreferences= PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor =sharedPreferences.edit();
editor.putString("key", "value");
editor.commit();

데이터 호출
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
String callValue = sharedPreferences.getString("key", "default value");


0 Comments
댓글쓰기 폼