Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

android java code : For this first assignment, you will create two types of rows in your RecyclerView: a normal row and a row for

android java code :

image text in transcribed

image text in transcribed

image text in transcribed

For this first assignment, you will create two types of rows in your RecyclerView: a normal row and a row for more serious crimes. To do so, you'll need to use the view type feature built into RecyclerView.Adapter. 1. Add a new property, mRequires Police to the Crime object and use it to decide which view to load on t To do so, you'll need to use the getItem View Type(int) method. 2. Add logic that returns a different View Holder based on the viewType value returned by getItem View Type(int) in the onCreateViewHolder method. Use the original layout for crimes that do not require police intervention. Add a new layout adding a button that says "Call Police" for crimes that do. The button should cause a Toast to pop up with the message "Police Are On Their Way!". Initialize the crimes list with some crimes that need the police (and some that don't) to demonstrate the new functionality. 17:00 Criminalintent Crime #0 Thu Nov 17 10:06:08 EST 2016 Crime #1 # Thu Nov 17 10:06:08 EST 2016 Call Police! Crime #2 Thu Nov 17 10:06:08 EST 2016 Call Police! Crime #3 Thu Nov 17 10:06:08 EST 2016 Of course, which row gets the button is going to depend on what mRequires Police is set to. Also, remember if the user taps the Call Police button, that toast is going to appear. Remember, you have to have two layouts, the original one and the new one with the Call Police button added. The adapter decides which one to use based on the mRequires Police attribute

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions

Question

What is the relationship between diversity, inclusion, and equity?

Answered: 1 week ago