thorbenprimke/realm-recyclerview

realm-recyclerview not refreshing while insert data first time

Closed this issue · 6 comments

A86S commented

while i am adding new data into realm database first time it is not reflecting in recyclerview for refreshing data i need to go back via back button then come back to screen. after that the data is reflecting in recyclerview properly while entering new data.

@A86S - Do you have automaticUpdate set to true in the adapter?

A86S commented

@thorbenprimke Yes i have already set automaticUpdate true in adapter but now i have managed the issue with RealmChangeListener. I am looking the change in database and reset my recyclerview with adapter for first time after that its working fine so no need to reset every time.

A86S commented

@thorbenprimke one more question regarding LayoutManager , We can reverse layout in RecyclerView with LinearLayoutManager.setReverseLayout(true) , how can we achieve the same with realm-recyclerview?

Thanks

Okay.

So when you change the Realm, those changes are reflected in the RecyclerView. Hmm. that shouldn't be the case.

@A86S - Can you provide more information what your primary key values look like?
The primary key is used to detect changes. If the key stays the same but the data of your Realm model changes, then you need an animateExtraColumnName. This could be a timestamp for example.

Yes, reversing the list / layout property is not supported at the moment. This could be easily added though by either adding another constructor parameter to the Adapter or by reversing your Realm results (sort desc vs asc).

There is no documentation about animateExtraColumnName at the moment. I need to fix that (or I always welcome PRs as well).

A86S commented

thanks @thorbenprimke for reply but animateExtraColumnName is not working for my case.
My Case : In my chat application it happens when i start new chat. Stanza Id is primary key for Message Realm Model which is look like "9gcnp-45".