//存入資料
SharedPreferences settings = null;
SharedPreferences.Editor editor = settings.edit();
editor.putInt("IntKey",50);
editor.commit();//要記得加

//取得資料
String PREFS_NAME = "test.this.activity";//一個標籤 可以設定為代表此APP的String Tag
int getInt ;
settings = getSharedPreferences(PREFS_NAME, 0);
getInt = settings.getInt("IntKey",0);//settings.getInt(所對應的key,如果抓不到對應的值要給什麼預設值)


arrow
arrow

    cookiesp 發表在 痞客邦 留言(0) 人氣()