Data Storage Methods

^Complicated and robust Android applications often need to utilize some type of data storage. Depending on the situation, different data storage methods are available to the developer:

■ Shared Preferences for lightweight usage, such as saving application settings and the user interface (UI) state

■ A built-in SQLite database for more complicated usage, such as saving application records

■ The standard Java flat file storage methods: InputFileStream and OutputFileStream

These are discussed in this chapter. Also discussed is the Content Provider Android component that is used to share data between applications. It should be noted that another basic data storage method managed by the Android system, the onSaveInstanceState() and onRestoreInstanceState() pair, was already discussed in Chapter 2,"Application Basics:Activities and Intents."The optimal method to use depends on the situation, as discussed in each case that follows.

Character Building Thought Power

Character Building Thought Power

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.

Get My Free Ebook

Post a comment