levibostian / AndroidBlanky

Create a new Android app fast. Comes pre-installed with libraries you already use.
7 stars 0 forks source link

Access and close() Realm correctly. #16

Closed levibostian closed 7 years ago

levibostian commented 8 years ago

Realm docs have ideas for how to close realm instances correctly. It is the responsibility of the Activity/Fragment/AsyncTask/Thread to close them.

Have SampleDao (BaseDao) take in an instance of Realm provided by Dagger. Then have BaseDao implement a close() function that closes Realm. Therefore, you will actually call close() on the Dao class when you need it in the app.

levibostian commented 7 years ago

This is done in another lib, not AndroidBlanky. AndroidRealm or Wendy?

levibostian commented 7 years ago

Done. This is done via the new Android Lifecycle stuff.