![]() ![]() ![]() Used in cases when more than one preference file required in Activity.Developer needs to use getSharedPreferences(String name,int mode) for custom preferences.Important Note: Mode are discussed in Custom preferences. Just because Activity contains only one preference file so getPreferences(int mode) function simply pass the name of Activity class to create a preference file. The function getPreferences(int mode) call the other function used to create custom preferences i.e getSharedPreferences(String name,int mode). To use activity preferences developer have to call function getPreferences (int mode) available in Activity class. They prefer using custom getSharedPreferences(String name,int mode). Developer doesn’t usually prefer using this even if they need only one preference file in Activity.It doesn’t require name as it will be the only preference file for this activity.Use only when one preference file is needed in Activity.For activity preferences developer have to call function getPreferences (int mode) available in Activity class.There are two different ways to save data in Android through Shared Preferences – One is using Activity based preferences and other is creating custom preferences. Two Ways To Save Data Through Shared Preference: 8 Code Of Saving & Retrieving Data in Shared Preference:.6 Read or get data from SharedPreferences.3 Important Google Recommend Naming Convention For Preference File:.2 Mode And Its Type In Shared Preference:.1 Two Ways To Save Data Through Shared Preference:. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |