Join David Gassner for an in-depth discussion in this video Adding data to shared preferences, part of Building a Note-Taking App for Android (2013).
As I previously described, I'm going to use shared preferences to store my notes…data on the android device. The shared preferences architecture…supports storage of key value pairs. And using the feed Java classes, it will…be possible to sort that data when needed. I'm working in a version of the project…called shared preferences, and I've opened the class notes data source.…This data source class will hide all the details of the implementation of my shared…preferences. So if I need to make changes to how the…data's being stored in the future, all of the changes will be confined to this…class. I'll double-click the Tab of the editor to…go to full screen. And then, place the cursor after the class…declaration to create an instances of a shared preferences storage area.…
All you have to do is to create an object, calling a method called get shared…preferences. Each instance of this shared preferences…data storage will be associated with a simple string that identifies it, and…makes it sharable for the entire application.…
Like its companions, this course will take you through building a complete mobile app from scratch; but this installment uses the Android SDK and Java to get the job done. Author David Gassner shows you how to install the SDK and the Android Developer Toolkit, create a project, save data on a device, build and control screen layouts, and create action bars and icons that control navigation.
These three related courses will use the same assets to develop the same app. (See Building a Note-Taking App for iOS and Building a Note-Taking App for Windows Phone 8 and Windows Store for more information.) Compare and contrast the different steps and discover the similarities and differences!
- Previewing the note-taking app
- Creating virtual devices for testing
- Unique concepts in Android
- Creating the Eclipse project
- Using local data storage
- Adding and retrieving data with the Shared Preferences API
- Creating screen designs
- Creating and editing notes
- Supporting older versions of Android with ActionBarSherlock