Most real Android apps have more than one activity, or screen. To share data between activities, you can follow a couple of different strategies. Let’s say the user touches an item in a ListView or RecylerView to select a data item. The natural response is to display the details of the selected data item. On a phone, you’ll do that by displaying a detail activity. If the data is static, or if it’s stored persistently on the device, you can just pass a unique identifier, or primary key, as something called an “intent extra”.
- [Instructor] Most real Android apps…have more than one activity or screen.…To share data between the activities,…you can follow a couple of different strategies.…Let's say that the user touches an item…in a list or a grid.…Right now I'm simply registering the event…and reporting which item the user selected…but in a finished app,…I might want to pass that data to another activity…for displaying detailed information…or otherwise processing the information.…To navigate to another activity…you use an intent object.…
The intent has information about the activity…that you want to display…but it also has something called an extras field…which is an implementation of a bundle,…a collection of key value pairs.…The bundle's keys are always strings.…The associated values are limited to simple types,…primitive numeric values and strings…or arrays of these types.…You can't pass primitive bullion values in…a bundle though,…so these are typically represented as integers…with values of zero or one.…
You can pass URIs or uniform resource identifiers.…
- Modeling data in POJO classes
- Customizing a ListView item display
- Displaying data in a RecyclerView
- Creating a custom array adapter
- Managing shared preferences with Java
- Creating and importing JSON data files
- Accessing SQLite from the command line
- Retrieving data with SQLite queries
Skill Level Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis3h 59m Intermediate
Android App Development: RESTful Web Serviceswith David Gassner2h 25m Intermediate
1. Display Static Data
2. Store Data in Shared Preferences
About shared preferences4m 41s
3. Store Data in Text Files
4. Manage Relational Data with SQLite
Next steps1m 43s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.