How to Define Shared Preferences with an Activity


show more Defining shared preferences with an activity provides you with in-depth training on Developer. Taught by David Gassner as part of the Android SDK: Local Data Storage show less
please wait ...

Defining shared preferences with an activity

In a previous video, I described how to set user preferences using Java code. Now, I'll show you how to create a PreferenceActivity, a user interface that lets the user type in values and save those values to persistent storage automatically. I'll be using a version of my project called Preference Activity that still has the buttons to set and show preferences but now no longer has an EditText control. I'll be handling user input through my new activity. I'll start by creating a new layout.

In the menu, I'll select File > New > Android XML file. I'll set the Resource Type to Preference, and then I'll give the file a name of settings. The .xml extension will be added automatically, and the new file will be saved into an XML subfolder underneath my Resources Area. I'll click Next, and I'll accept all the defaults here and click Finish. That creates my new XML file. The file might open to this view--the XML view--or might open to the Structure view....

Defining shared preferences with an activity
Video duration: 10m 50s 3h 41m Intermediate

Viewers:

Defining shared preferences with an activity provides you with in-depth training on Developer. Taught by David Gassner as part of the Android SDK: Local Data Storage

Subject:
Developer
Software:
Android Java
Author:
please wait ...