Solution 1 :
You forgot adding start listening method for your adapters.
@Override
protected void onStart() {
super.onStart();
adapter.startListening();
}
Problem :
I made FirestoreRecycleview in home-menu, when run app FirestoreRecycler
work properly but when I open other Menu in Bottom Navbar, FirestoreReclyclerview
not Load data
for Example :
- I Have Bottom Navbar with 2 Fragment A and B
- In Fragment A, I Have A RecycleView with Adapter From FirestoreRecyclerAdapter
- when I open Fragment B and open Fragment A again, fragment A doesn’t show Data in recyclerview
This is When run app in First Time :
This is After I Click other navbar button and open this fragment again :
this is my code that I call in onCreate()
private void setkelaslist() {
Query query = fdb.collection("kelas").whereEqualTo("email",email_txt);
FirestoreRecyclerOptions<kelas_profil> options = new FirestoreRecyclerOptions.Builder<kelas_profil>().
setQuery(query,kelas_profil.class)
.build();
adapter = new listkelasadapter(options,this);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
adapter.startListening();
adapter.notifyDataSetChanged();
recyclerView.setAdapter(adapter);
}
Another request: one more question, I delete items with a button click, it is deleted but when I create a new item with same data, in Toast it says Complete but it doesn’t add data.
Comments
Comment posted by AiHaQ
I have add onstart.. But it still show the same problem… Sometime show and not.. Maybe network or something either?