title | type | duration | creator | ||||
---|---|---|---|---|---|---|---|
RecyclerView |
Lab |
1:30 |
|
Note: This can be a pair programming activity or done independently.
In this lab you will be using your knowledge of RecyclerView to build an app.
- You need to create one Activity to hold your RecyclerView
- Add the RecylerView to your XML
- Get a reference to the
XML
createdRecyclerView
inside theonCreate()
method inJava
in both activities. - Set up the layout manager for the
RecyclerView
in both activities.
- Create a custom
XML
layout that replicates the following.
- Create a custom
RecyclerView ViewHolder
. - The
ViewHolder
should get a reference to the custom view layout you created inXML
.
- Create a custom
Java
objects that hold this data: - The object should hold a
title
, adescription
, acolor
, and acheck
to see if the item was selected. - Make sure you create
getters/setters
andconstructors
that will help you with the requirements.
- Create a custom
RecyclerView Adapter
. - The adapter should use the custom
ViewHolder
.
- Have the
OnClickListener
show aToast
that changes the checked value of both the object and view. Make sure it maintains that checked state when scrolling.
- Create and populate a
List
that contains ten instances of your customJava
object. - Provide the custom adapter this list to use.
- Set your custom adapter on the
RecyclerView
.
Bonus: How would you change your classes to allow for more than one type of view in one RecyclerView adapter?
A pull request from forked GitHub repo that contains your implementation of the requirements.
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact legal@ga.co.