Skip to content Skip to sidebar Skip to footer

App Updates Data In Firebase Real-time Database But Doesn't Show Anything In Recyclerview

I am trying to add data onto firbase realtime database and retrieve that data on a recyclerview.I am successfully able to do that but when i try to retrieve data from firebase its

Solution 1:

I had the same problem. Its reason is that when firebase hasn't read data from realtime database yet, recyclerview has been made; and it hasn't have any data yet. For solving that you should make recyclerview when you are sure that firebase has read data. Then recyclerview will be made with correct data.

Solution 2:

First i will recommend you don't pass list in adapter . Create setList method in adapter.

If you still passing list in adapter then TRY THIS

Replace this in line childadded method

  modelAdapter.notifyDataSetChanged();

With this two line

    modelAdapter = newmModelAdapter(this,mDataList); //this will recreate the adapter with new data
    mRecyclerView.setAdapter(modelAdapter); //Again set adapter to recyclerview

Solution 3:

java inner class dos't access outer local declared variable.So you need do

publicList<User> mDataList = new ArrayList<>();

OR

use interface

Post a Comment for "App Updates Data In Firebase Real-time Database But Doesn't Show Anything In Recyclerview"