When you display a row in a ListView, you always use an adapter class and a layout file. The adapter manages data at runtime, and the layout file defines how the data looks to the user. You can customize the visual presentation by creating your own custom adapters and layout files. David describes how to do this in his sample app.
- [Instructor] When you're displaying data in a list view,…the job of the adapter is to respond to user events…as they cycle through the list.…The adapter cycles through the underlying data…and then creates and populates views…in your item rows.…When you're using the default array adapter,…and the layouts that are included with the Android SDK,…it's all automatic.…But to customize the display,…you'll need to create your own custom adapter classes…and XML layouts.…You'll then write a bit of code…that receives the data objects from the adapter,…and displays it in views that are part of the layout.…
I'll start by showing you how to create the layout file,…and then I'll go on to create the custom adapter.…In this project named Custom Item Layout,…my main activity class has been cleaned up a bit.…I still have the code to sort complex data objects,…but I've cleaned up everything else.…I'll go to the resources folder in the project window,…and I'll show you that there's a drawable folder…here with a file called Apple_Pie.jpg.…
- 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 49m 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.