Question: Lab 2 : Firebase RecyclerView Ini al Set - up: 1 . Open your Lab 1 Project you created last week 2 . Make sure

Lab 2: Firebase RecyclerView
Inial Set-up:
1. Open your Lab 1 Project you created last week
2. Make sure youre logged into your google account in your browser
3. Open Build.gradle (Module) and add the following to dependencies (or the most recent version):
Coding MainAcvity.kt:
HINT: See KotlinRealmeDB.zip in Week 3 on eConestoga for help, the app is similar to this lab 4.
5. Inside onCreate add the following:
a val query: A query object searching the products document
b val opons: An opon object that connects the query with your Kotlin data class
c adapter: construct using ProductAdapter and passing opons into the constructor
d val rView: A RecyclerView object which uses findViewById to connect to the
RecyclerView in acvity_main.XML file
e Set the adapter and layoutmanager properes of rView (it should use a
LinearLayoutManager)
6. Add the onStart below onCreate with the following code:
Coding ProductAdapter.kt:
7. Set up your ProductAdapter class declaraon like the PhoneAdapter class we covered in the Week 4
lecture.
8. Inside MyViewHolder: get references to the TextView widgets inside row_layout.xml using findViewById
9. Inside onBindViewHolder: display the name and price using the models properes
Zip your project and upload a screenshot of the device emulator displaying the data from Realme Database.
Do not zip the screenshot in the project folder, upload the screenshot separately.
The end result should be a RecyclerView displaying all the names and roles you put inside the products
database created in Firebase last week.
This is part 2 of a 3 part lab, so make sure youve completed it correctly. Ask your professor if you have
any issues.

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!