0

I am using android room and live data .I am trying to show some 1000 text messages in a window. When ever a new insert happens observer gets called after say 20-30 secs. The code is straight forward .

// dummy code
db.messageModelDao().insertMessage(_message)

readMessagesObserver = Observer<List<ChatMessage>> { newMessages ->
//print Messages
}

I tried the implement dagger as suggested in the below thread, Room - LiveData observer does not trigger when database is updated

but could not find any visible difference

Why there is a delay in observer time when query returns a large data?

saravana
  • 1
  • 2
  • I think that 1000 messages just take a long time to load from the DB and the observer isn't called until the load is complete. You should try to reduce the amount of data you are loading into smaller chunks. – Itamar Kerbel May 05 '19 at 08:58
  • thanks @ItamarKerbel , I guess the issue is because large amount of data. Implementing pagedlist resolved the issue for us. – saravana May 09 '19 at 16:10

0 Answers0