//存入資料 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,如果抓不到對應的值要給什麼預設值)
文章標籤
全站熱搜
留言列表