Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

715
Views
How to create and use a Room Database in Kotlin [Dagger-Hilt]

This is a self-answered question which I intended to ask earlier as I had rep exposure issues in my project, but ended up fixing it after a couple of hours of research. Instead of staying silent, I thought this might help someone in the future. This tutorial demonstrates how you can create a Room database and use it within an activity/fragment. The example use case given here is querying the size of your database and updating the views in a fragment.

Note: There is some Dagger-Hilt dependency injection in the code that follows, but the same methodology should apply if you're manually doing your own dependency injection. I also expect that you have some basic knowledge of MVVM architecture. You may find useful Java related questions here if you're interested in other ways to do this involving LiveData: resource 1, resource 2; however, the focus is on Kotlin and this solution doesn't require LiveData.

over 4 years ago · Hanz Gallego
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!