For this advanced challenge, create two types of rows in your RecyclerView: a normal row and a row for more serious crimes. To implement this, you will need to work with the view type feature available in RecyclerView.Adapter.
Add a new property, requiresPolice, to the Crime object and use it to determine which view to load on the CrimeListAdapter by implementing the getItemViewType(Int) function (developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#getItemViewType(int)).
In the onCreateViewHolder(ViewGroup, Int) function, 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 police intervention and a new layout with a streamlined interface containing a button that says “contact police” for crimes that do.
3.137.161.251