开发者

how to getSharedPreferences in dialog?

开发者 https://www.devze.com 2022-12-20 08:57 出处:网络
i want to read file in dialog can any开发者_StackOverflow社区 one guide me how to achieve this? when i use

i want to read file in dialog

can any开发者_StackOverflow社区 one guide me how to achieve this?

when i use

SharedPreferences preferences = getSharedPreferences(PREF_FILE_NAME, MODE_PRIVATE); in dialog it gives me error "method is undefined"


Use the Context to access the preferences.

context.getSharedPreferences(PREF_FILE_NAME, MODE_PRIVATE);


You can get the context using super.getContext():

super.getContext().getSharedPreferences(PREFS_NAME, 0);
0

精彩评论

暂无评论...
验证码 换一张
取 消