Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class DataBase @Inject constructor() {
private val realmLock = RealmLock()
//Backround thread transaction
override fun saveLanguage(jsonArray: JSONArray) {
this.realmLock.transaction {
it.createAllFromJson(Language::class.java, jsonArray)
}
}
//UI thread transaction
private fun getFeedItem(id: String): HomeFeedItem? {
return realmLock.getRealm()
.where<HomeFeedItem>().equalTo("_id", id).findFirst()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment