How do I popular the user, and use their data to popular the View?

Asked

Viewed 16 times

0

MVP is something new for me and I’ve been having some difficulties. I would like to know, how I should create a class to receive the data of my logged user from the Firebase database to popular my View. I thought about using a Singleton, I saw in some examples that it’s an option, but it’s not ideal because it makes it difficult to test the code, so how should I create this class that I need access to almost all the time?

1 answer

0


My tip for you is to use dependency injection, this will make the code testable and at the same time you can have relatively easy access to the objects you want often.

The famous libraries for dependency injection for android are:

  • Hilt, brand new, and be easy to start, based and utilizing Dagger components, so you can stay as robust as Dagger if you need to.
  • Dagger, a robust and more complex to start.
  • Koin, easier than Dagger and as good as, easy to start and with more syntax "Kotlin".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.