Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- JSON
- properties
- input
- MySQL
- 와일드카드
- Spring
- junit
- 리눅스
- tomcat
- laravel
- 안드로이드
- jquery
- javascript
- curl
- DB
- CentOS
- SeLinux
- java
- Linux
- Android
- larravel
- ajax
- File
- error
- 정규식
- 이클립스
- NetBeans
- php
- 톰캣
- html
Archives
- Today
- Total
합쭈기 programming
SharedPreferences 본문
public class Repository { private static Repository repository; private SharedPreferences sharedPreferences; public static Repository getInstance(Context context) { if(repository == null) repository = new Repository(context); else if(repository.isNullSharedPreferences()) repository = new Repository(context); return repository; } public void setNotifyCnt(int cnt) { sharedPreferences.edit().putInt("cnt", cnt).commit(); } public int getNotifyCnt() { return sharedPreferences.getInt("cnt", 0); } public void setServerUrl(String url) { sharedPreferences.edit().putString("url", url).commit(); } public String getServerUrl() { return sharedPreferences.getString("url", ""); } private Repository(Context context) { sharedPreferences = context.getApplicationContext().getSharedPreferences(getClass().getPackage().getName(), Context.MODE_PRIVATE); } }
'Java > Android' 카테고리의 다른 글
sqlite 기본 (0) | 2015.04.13 |
---|---|
스크롤 안에 리스트 (0) | 2015.04.13 |
http connect - json (0) | 2015.04.13 |
http connect - 파일 업로드 (0) | 2015.04.13 |
hidden keyboard (0) | 2015.04.13 |