October 2018
Intermediate to advanced
464 pages
15h 17m
English
The default CursorAdapter requires a Content Provider URI. Since we are accessing the SQLite database directly (and not through a Content Provider), we don't have a URI to pass, so instead, we created a custom adapter by extending the CursorAdapter class. DictionaryAdapter still performs the same functionality as SimpleCursorAdapter from the previous recipe, namely mapping the data from the cursor to the item layout.
The next class we added was DictionaryLoader, which handles populating the adapter. As you can see, it's actually very simple. All it does is return the cursor from getWordList(). The key here is that this query is being handled in a background thread and will call the onLoadFinished() callback (in MainActivity.java ...