When I am inserting the first item into the recycler view, it does not automatically refresh. Subsequent insertions are working fine. I have set the automaticUpdate to true. Right now, I am checking if the data only has 1 item and if it is true, I will create a new adapter. Although this works, this does not seem to be the correct way of handing insertions.
new Realm.Transaction.OnSuccess() {
@Override
public void onSuccess() {
RealmResults<Transaction> mTransactions = realm.where(Transaction.class).findAllSorted("id", Sort.ASCENDING);
if (mTransactions.size() == 1) {
mRealmAdapter = new TransactionRealmAdapter(getActivity(), mTransactions, true, true, true, "date");
mRealmRecyclerView.setAdapter(mRealmAdapter);
}
mRealmAdapter.notifyDataSetChanged();
}
When I am inserting the first item into the recycler view, it does not automatically refresh. Subsequent insertions are working fine. I have set the
automaticUpdate
to true. Right now, I am checking if the data only has 1 item and if it is true, I will create a new adapter. Although this works, this does not seem to be the correct way of handing insertions.