正在加载图片...
Obtaining a SharedPreferences Object Two methods that return a SharedPreferences object: getSharedPreferences(String name,int mode) o Use if you need multiple preferences files identified by name. o Name is specified as the first parameter. o If a preferences file by this name does not exist,it will be created when you retrieve an editor. o Preferences can be accessed by all activities in the application. getPreferences(int mode) o Use if you need only one preferences file for your Activity. o Only one preferences file for an Activity-don't supply a name. o Calls method getsharedPreferences(String,int)passing in this activity's class name as the preferences name. o Preferences are not shared with other activities in the application. 10Obtaining a SharedPreferences Object Two methods that return a SharedPreferences object: • getSharedPreferences(String name, int mode) o Use if you need multiple preferences files identified by name. o Name is specified as the first parameter. o If a preferences file by this name does not exist, it will be created when you retrieve an editor. o Preferences can be accessed by all activities in the application. • getPreferences(int mode) o Use if you need only one preferences file for your Activity. o Only one preferences file for an Activity – don't supply a name. o Calls method getSharedPreferences(String, int) passing in this activity’s class name as the preferences name. o Preferences are not shared with other activities in the application. 10
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有