Firebase RecyclerView in Fragment : <p>Can anyone help with this situation? I want to show history in a recycleview in a fragment from firebase database. But doesn't show. What went wrong i can not figure out. The app works fine but showing nothing in recyclerview.</p>

<p>My history class</p>

<pre><code>public class History {

public String Date;
public String Amount;
public String Via;
public String Mobile_Number;

public History() {
}

public History(String date, String amount, String via, String mobile_Number)  
{
    Date = date;
    Amount = amount;
    Via = via;
    Mobile_Number = mobile_Number;
}

public String getDate() {
    return Date;
}

public void setDate(String date) {
    Date = date;
}

public String getAmount() {
    return Amount;
}

public void setAmount(String amount) {
    Amount = amount;
}

public String getVia() {
    return Via;
}

public void setVia(String via) {
    Via = via;
}

public String getMobile_Number() {
    return Mobile_Number;
}

public void setMobile_Number(String mobile_Number) {
    Mobile_Number = mobile_Number;
}
}
</code></pre>

<p>I am using this viewholder class.</p>

<pre><code>public class History {

public String Date;
public String Amount;
public String Via;
public String Mobile_Number;

public History() {
}

public History(String date, String amount, String via, String mobile_Number) 
{
    Date = date;
    Amount = amount;
    Via = via;
    Mobile_Number = mobile_Number;
}

public String getDate() {
    return Date;
}

public void setDate(String date) {
    Date = date;
}

public String getAmount() {
    return Amount;
}

public void setAmount(String amount) {
    Amount = amount;
}

public String getVia() {
    return Via;
}

public void setVia(String via) {
    Via = via;
}

public String getMobile_Number() {
    return Mobile_Number;
}

public void setMobile_Number(String mobile_Number) {
    Mobile_Number = mobile_Number;
}
}
</code></pre>

<p>This fragment is used on pager.</p>

<pre><code> @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    mMainView = inflater.inflate(R.layout.fragment_profile, container, 
false);


    recyclerView = (RecyclerView) 
mMainView.findViewById(R.id.profile_recycler);


    String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();
    String email = FirebaseAuth.getInstance().getCurrentUser().getEmail();


    mDatabase = 
FirebaseDatabase.getInstance().getReference().child("Users").child(uid);
    mDatabase.keepSynced(true);



    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    Query query = FirebaseDatabase.getInstance()
            .getReference()
            .child("Users").child(uid).child("History").orderByKey();

    FirebaseRecyclerOptions&lt;History&gt; options = new 
FirebaseRecyclerOptions.Builder&lt;History&gt;()
            .setQuery(query, History.class).build();

    FirebaseRecyclerAdapter adapter = new 
FirebaseRecyclerAdapter&lt;History,HistoryViewHolder&gt;(options) {
        @Override
        protected void onBindViewHolder(@NonNull HistoryViewHolder holder, 
int position, @NonNull History model) {
            holder.setAmountText("100");
            holder.setDateText("dd-mm-yyyy");
            holder.setMobileText("model.getMobile_Number()");
            holder.setViaText("model.getVia()");
        }


        @Override
        public HistoryViewHolder onCreateViewHolder(ViewGroup parent, int 
viewType) {
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.history_layout,parent,false);

            return new HistoryViewHolder(view);
        }
    };

    recyclerView.setAdapter(adapter);

    return mMainView;
}
</code></pre>

<p>History layout to populate every data</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"&gt;


&lt;TextView
    android:id="@+id/history_date"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="0dp"
    android:layout_marginTop="4dp"
    android:fontFamily="serif"
    android:text="Date"
    android:textColor="@color/colorPrimary"
    android:textStyle="bold" /&gt;

&lt;TextView
    android:id="@+id/history_mobile_number"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/history_date"
    android:layout_marginStart="16dp"
    android:layout_toEndOf="@+id/history_date"
    android:text="Mobile Number" /&gt;

&lt;TextView
    android:id="@+id/history_via"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignStart="@+id/history_mobile_number"
    android:layout_below="@id/history_mobile_number"
    android:text="Via"
    android:textStyle="bold" /&gt;

&lt;TextView
    android:id="@+id/history_amount"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignStart="@+id/history_via"
    android:layout_below="@+id/history_via"
    android:layout_marginBottom="4dp"
    android:text="Taka" /&gt;
&lt;/RelativeLayout&gt;
</code></pre>
