List with custom objects and adapter
Putting it all together
We’ve defined the project, layouts, objects, and adapter. Now that we have our new tools, we need to put them together to achieve our goal.
In order to make use of our new adapter, we’ll need to go back to our original Activity. We need to do the following:
- Reference the ListView in the MainActivity
- Bind the ListView to the NewsEntryAdapter
- Populate the NewsEntryAdapter with NewsEntry objects
Here is the code we came up with:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
|
And that’s it! There are a lot more options to explore with ListViews and Adapters not covered here (yet.)
Consider leaving a comment if you would like to see other details covered from this article, any mistakes, or general questions. Thanks for reading!
No comments:
Post a Comment