8.3 Technologies Overview

This section introduces the features you’ll use to build the Twitter Searches app.

8.3.1 Storing Key–Value Data in a SharedPreferences File

Each app can have SharedPreferences files containing key–value pairs associated with the app—each key enables you to quickly look up a corresponding value. Chapter 4’s Flag Quiz app stored the app’s preferences in a SharedPreferences file on the device. That app’s PreferenceFragment created the SharedPreferences file for you. In this app, you’ll create and manage a SharedPreferences file called searches in which you’ll store the pairs of tags (the keys) and Twitter search queries (the values) that the user creates. Once again, you’ll use a SharedPreferences.Editor to make changes ...

Get Android How to Program, 3/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.