閱讀409 返回首頁    go 阿裏雲 go 技術社區[雲棲]


SharedPreferences





  private void saveAccount(String username, String password) {
		    SharedPreferences sp = this.getPreferences(this.MODE_PRIVATE); // 獲得Preferences
			SharedPreferences.Editor editor = sp.edit(); // 獲得Editor
			editor.putString("username", username); // 將用戶名存入Preferences
			editor.putString("password", password); // 將密碼存入Preferences
			editor.commit();
	   }
	  
	  private Map<String, String> getAccount(){
		  SharedPreferences sp = this.getPreferences(this.MODE_PRIVATE);
		  Map<String, String> m = new Map<String, String>();
		  m.put("username", sp.getString("username", ""));
		  m.put("password", sp.getString("password", ""));
	  }











最後更新:2017-04-03 12:54:29

  上一篇:go Vxworks 6.6係列下載地址
  下一篇:go VxWorks:添加自己組件到Tornado