When you’re displaying data in a ListView, the job of the adapter is to respond to user events as they cycle through the list. The adapter cycles through the underlying data. It creates and populates views in your list items. When you’re using the default ArrayAdapter and the layouts that are included with the Android SDK, it’s all quite automatic. To customize the display, you’ll need to create your own custom adapter classes and XML layout. You’ll then write a bit of code that receives data objects from the adapter and displays it in views that defined in the layout.
- [Instructor] There are a couple of different widgets…in the Android SDK that you can use to display…lists of data.…An older component named ListView that's been part…of the SDK since Android's early days, and a newer component…named RecyclerView that was introduced in 2014.…I'll start with the ListView component, and then show you…RecyclerView in a later video.…I'm going to first describe how to display a simple list…of Strings, and then I'll expand that to more customized…displays of complex data objects.…
I'm working in a project named ListView.…As with the previous exercise, I have a sample data provider…where I'm getting the data from, and in my main activity,…I'm working with just a single object right now.…I'm going to comment out a good bit of this code.…I'm going to get rid of all the references…to the TextView object that I named tvOut, and I'll also…comment out the code that's sorting the data collection,…because again, I'm just going to work with a simple…String set now.…
Now I'll go back up to the top of my Activity class,…
- 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.