Question: Lab 2 : Firebase RecyclerView Ini al Set - up: 1 . Open your Lab 1 Project you created last week 2 . Make sure
Lab : Firebase RecyclerView
Inial Setup:
Open your Lab Project you created last week
Make sure youre logged into your google account in your browser
Open Build.gradle Module and add the following to dependencies or the most recent version:
Coding MainAcvitykt:
HINT: See KotlinRealmeDBzip in Week on eConestoga for help, the app is similar to this lab
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 acvitymain.XML file
e Set the adapter and layoutmanager properes of rView it should use a
LinearLayoutManager
Add the onStart below onCreate with the following code:
Coding ProductAdapter.kt:
Set up your ProductAdapter class declaraon like the PhoneAdapter class we covered in the Week
lecture.
Inside MyViewHolder: get references to the TextView widgets inside rowlayout.xml using findViewById
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 of a 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
