title: FirestoreRecyclerAdapter not calling onCreateViewHolder
body: <p>I'm following <a href="https://www.youtube.com/watch?v=cBwaJYocb9I" rel="nofollow noreferrer">this tutorial</a>, according to which when I start my app I should be able to see the items (documents) which are already added to Firestore. But this is happening</p>
  
  <p><a href="https://i.stack.imgur.com/3iDBu.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3iDBu.gif" alt="enter image description here"></a></p>
  
  <p><strong>The <code>onCreateViewHolder</code> is called only when I tap on <code>textview</code></strong>, and when out of focus, the view is refreshed.
  I don't understand what is going on. I tested my app on <a href="https://www.browserstack.com/app-live" rel="nofollow noreferrer">Browserstack</a>, and getting the same issue with other devices too.</p>
  
  <p>Here is my code: </p>
  
  <h3>ScrollingActivity.java</h3>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_scrolling);
      Log.d(TAG, "onCreate: started");
  
      RecyclerView recyclerView = findViewById(R.id.expense_list);
  
      FirebaseFirestore db = FirebaseFirestore.getInstance();
      mAuth = FirebaseAuth.getInstance();
      Query query = db.collection("users").document(mAuth.getCurrentUser().getUid()).collection("expenses");
  
      FirestoreRecyclerOptions&lt;Expense&gt; options = new FirestoreRecyclerOptions.Builder&lt;Expense&gt;()
              .setQuery(query,  Expense.class)
              .build();
  
      adapter = new FirestoreRecyclerAdapter&lt;Expense, ExpenseViewHolder&gt;(options) {
          @NonNull
          @Override
          public ExpenseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
              Log.d(TAG, "onCreateViewHolder: called");
              LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
              View view = layoutInflater.inflate(R.layout.individual_expenditure_layout, parent, false);
              return new ExpenseViewHolder(view);
          }
  
          @Override
          protected void onBindViewHolder(@NonNull ExpenseViewHolder expenseViewHolder, int position, @NonNull Expense expense) {
              Log.d(TAG, "onBindViewHolder: called");
              expenseViewHolder.setAmount(expense.getAmount());
              expenseViewHolder.setDescription(expense.getDescription());
          }
      };
  
      recyclerView.setHasFixedSize(true);
      recyclerView.setLayoutManager(new LinearLayoutManager(this));
      recyclerView.setAdapter(adapter);
  }
  
  @Override
  protected void onStart() {
      super.onStart();
      adapter.startListening();
  }
  
  
  @Override
  protected void onStop() {
      super.onStop();
      adapter.stopListening();
  }
  </code></pre>
  
  <h3>Expense.java</h3>
  
  <pre><code>public class Expense {
  
      private Timestamp timestamp;
      private float amount;
      private String description;
  
      public Expense() { timestamp = Timestamp.now(); }
  
      public Expense(float amount, String description){
          this.timestamp = Timestamp.now();
          this.amount = amount;
          this.description = description;
      }
  
      public float getAmount() {
          return amount;
      }
  
      public String getDescription() {
          return description;
      }
  }
  </code></pre>
  
  <h3>ExpenseViewHolder.java</h3>
  
  <pre><code>public class ExpenseViewHolder extends RecyclerView.ViewHolder {
  
      private TextView textView_amount, textView_description;
  
      public ExpenseViewHolder(@NonNull View itemView) {
          super(itemView);
  
          textView_amount = itemView.findViewById(R.id.textView_Amount);
          textView_description = itemView.findViewById(R.id.textView_Description);
      }
  
      public void setAmount(float amount) {
          textView_amount.setText(String.format(Locale.US,"₹ %.2f", amount));
      }
  
      public void setDescription(String description) {
          textView_description.setText(description);
      }
  }
  </code></pre>
  
  <h3>activity_scrolling.xml</h3>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context=".ScrollingActivity"&gt;
  
      &lt;androidx.core.widget.NestedScrollView
          android:id="@+id/nestedScrollView"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_anchorGravity="center"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"
          android:paddingBottom="130dp"&gt;
          &lt;!--    TODO: This paddingBottom will not work for every device    --&gt;
  
          &lt;androidx.recyclerview.widget.RecyclerView
              android:id="@+id/expense_list"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"&gt;
  
          &lt;/androidx.recyclerview.widget.RecyclerView&gt;
      &lt;/androidx.core.widget.NestedScrollView&gt;
  
      &lt;include
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          layout="@layout/add_expense_form"
          android:layout_gravity="bottom"
          /&gt;
  
  
  &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>I have been stuck on this for 2 days now. </p>
  
  <p>Didn't find these helpful: <a href="https://stackoverflow.com/questions/47585582/firestorerecycleradapter-not-updating-views">FirestoreRecyclerAdapter not updating views</a>, <a href="https://stackoverflow.com/questions/28992929/recyclerview-not-calling-oncreateviewholder-or-onbindview/47973416">RecyclerView not calling onCreateViewHolder or onBindView</a>, <a href="https://stackoverflow.com/questions/50119627/cant-get-firestorerecycleradapter-to-show-items">Can&#39;t get FirestoreRecyclerAdapter to show items</a></p>
  
  <p>Found <a href="https://codinginflow.com/tutorials/android/firebaseui-firestorerecycleradapter/part-3-firestorerecycleradapter" rel="nofollow noreferrer">this tutorial</a>, they have done similar stuff only. Don't know why this happening with me.</p>