Добавить
Уведомления

Android Tutorial 68 - Reading and Writing Preferences

This is an excerpt from Learn by Doing - Android for Beginners on Udemy. https://www.udemy.com/learn-by-doing-android-for-beginners/ You will learn how to, 1. Read from Preferences 2. Write to Preferences Things to Remember ----------------------------- 1. Obtain an instance of your SharedPreferences using the PreferenceManager.getDefaultSharedPreferences(Context) method. 2. Use the SharedPreferences.get*(String, *) set of methods to read a preference. 3. In order to write to a preference you will need an instance of an Editor, which is available from SharedPreferences.edit() method. 4. Put in new preferences using the Editor.put*(String, *) set of methods. 5. And make sure that you call the Editor.commit() method to save your changes.

Иконка канала Android Lovers
3 подписчика
12+
12 просмотров
Год назад
24 октября 2024 г.
12+
12 просмотров
Год назад
24 октября 2024 г.

This is an excerpt from Learn by Doing - Android for Beginners on Udemy. https://www.udemy.com/learn-by-doing-android-for-beginners/ You will learn how to, 1. Read from Preferences 2. Write to Preferences Things to Remember ----------------------------- 1. Obtain an instance of your SharedPreferences using the PreferenceManager.getDefaultSharedPreferences(Context) method. 2. Use the SharedPreferences.get*(String, *) set of methods to read a preference. 3. In order to write to a preference you will need an instance of an Editor, which is available from SharedPreferences.edit() method. 4. Put in new preferences using the Editor.put*(String, *) set of methods. 5. And make sure that you call the Editor.commit() method to save your changes.

, чтобы оставлять комментарии