Question: Using Android Studio, create two types of rows in your RecyclerView: a normal row and a row for more serious crimes. To implement this, you

Using Android Studio,

create two types of rows in your RecyclerView: a normal row and a row for more serious crimes.

To implement this, you will work with the view type feature available in RecyclerView.Adapter. Add a new property, mRequiresHR, to the Crime object and use it to determine which view to load on the CrimeAdapter by implementing the getItemViewType(int) method (developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html#getItemViewType(int)).

In the onCreateViewHolder(ViewGroup, int) method, you will also need to add logic that returns a different ViewHolder based on the new viewType value returned by getItemViewType(int). Use the original layout for crimes that do not require human resources intervention and a new layout with a streamlined interface containing a button that says contact HR for crimes that do.

The repository is available at

https://bitbucket.org/brianthoms/criminalintent-2/downloads/

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!