1
類
我有下面的類:在非活動獲得SharedPreferences
public class UserPref {
Context context;
SharedPreferences sharedPref;
public SessionUtils(Context context) {
this.context = context;
sharedPref = context.getPreferences(Context.MODE_PRIVATE);
}
}
不過,我得到了上getPreferences()
以下錯誤:
無法解析法 '的getPreferences(INT)'
爲什麼?我該如何解決?
難道你錯過了 「關鍵」:'的getPreferences( 「鑰匙」,Context.MODE_PRIVATE)' –