Join David Gassner for an in-depth discussion in this video Customizing data display with a CursorAdapter, part of Building a Note-Taking App for Android.
- One of my app's requirements is that…it handled long notes.…Right now, it's handling a long, single-line note elegantly,…cutting off the text as necessary and adding ellipses,…but it's not handling multi-line notes well.…It's just truncating the text at the line feed.…And as I can see in my code, there's more to the text.…I have a line feed, and then another word.…To handle this, I'll need to create a custom cursor adapter.…Right now, in my main activity,…I'm using a built-in class from the Android SDK…called the SimpleCursorAdapter.…
And this cursor adapter knows how to pass text…directly from the cursor, that is from the database,…right into the layout.…But if I want to change the text…and the way it's displayed dynamically,…I need to create my own cursor adapter.…So I'll go to my project window…and I'll right-click on my default package,…and I'll create a new Java class.…And I'll name it NotesCursorAdapter.…I'll get rid of this comment,…and then I'll extend the CursorAdapter class.…
The CursorAdapter class is in the package android.widget…
Building a Note-Taking App for iOS 8 and Building a Note-Taking App for Windows Phone 8 and Windows Store use the same assets to develop a similar app. Compare and contrast the steps and discover the similarities and differences between the three platforms.
- Understanding Android UI and data management patterns
- Creating an Android Studio project
- Customizing material design theme colors
- Defining an SQLite database structure
- Managing data with ContentProvider and Loader classes
- Retrieving and displaying data
- Customizing data display with a CursorAdapter
- Creating, updating, and deleting notes
- Preparing the app for deployment