android中SharedPreferences

 

SharedPreferences sharedPreference = context.getSharedPreferences(fileName, Context.MODE_PRIVATE) ;
		Editor editor = sharedPreference.edit() ;
		editor.putString("userNo", userNo) ; 
		editor.putString("userPass", userPass) ; 
		editor.commit() ; 

 

 

SharedPreferences sharedPreference = context.getSharedPreferences(fileName, Context.MODE_PRIVATE) ;
		String userNo = sharedPreference.getString("userNo", "") ; 
		String userPass = sharedPreference.getString("userPass", "") ; 
		HashMap<String, String> hashMap = new HashMap<String, String>() ; 
		hashMap.put("userNo", userNo) ; 
		hashMap.put("userPass", userPass) ; 
		return hashMap ; 

 

你可能感兴趣的:(android中SharedPreferences)