2

I have 2 tables, first 'group' and second 'messages' and load messages from message table by group id and Paging library, My problem is every time new messages arrived from server and save in messages table Room notify LiveData data changed in table message and if for example I was open MessagesActivity for group 1, if new message arrive for group 2, because that added to messages table, room notify data updated (Which i don't want that).

So please help me:

Select * FROM messages WHERE groupId = 1 

I need Room notify LiveData just if new message arrive for group which currently user open that

  • You need to show more relevant code about your DAO and ViewModels for instance. – Vincent Mimoun-Prat Feb 10 '20 at 10:44
  • I think question is clear, I have a query `Select * FROM messages WHERE groupId = 1` and I want room notify live data just when new message insert to table for **group 1** and if new message insert for **group 2** room don't notify LiveData – Masoud Kardani Feb 10 '20 at 10:50
  • 1
    [This answer](https://stackoverflow.com/a/47350355/7858689) may be useful – hassan moradnezhad Feb 10 '20 at 21:33
  • @hassanmoradnezhad So as I understand that's a maybe bug or something like that in Room+LiveData :/and the solution is just a filter after all data loaded again and again! – Masoud Kardani Feb 11 '20 at 08:21

0 Answers0