title: Getting a Blank ListView after retrieving data from firebase
body: <p>I am getting a blank listView on running this code.I have checked the contents of the array by displaying them in a text view to the bottom of the listView.Changing to linear layout didn't work as well.
  This is my first time using a listView so forgive me if its a stupid question.</p>
  <p><strong>XML CODE</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:background=&quot;@drawable/gradient_background&quot;
      tools:context=&quot;.current_month&quot;&gt;
  
      &lt;ListView
          android:id=&quot;@+id/barcode_detail&quot;
          android:layout_width=&quot;374dp&quot;
          android:layout_height=&quot;403dp&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintHorizontal_bias=&quot;0.486&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          app:layout_constraintVertical_bias=&quot;0.277&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/title_tv&quot;
          android:layout_width=&quot;299dp&quot;
          android:layout_height=&quot;42dp&quot;
          android:layout_marginStart=&quot;141dp&quot;
          android:layout_marginEnd=&quot;141dp&quot;
          android:fontFamily=&quot;sans-serif-black&quot;
          android:textAlignment=&quot;center&quot;
          android:textColor=&quot;#F7F3F3&quot;
          android:textSize=&quot;24dp&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          app:layout_constraintVertical_bias=&quot;0.037&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/resultView&quot;
          android:layout_width=&quot;245dp&quot;
          android:layout_height=&quot;143dp&quot;
          android:layout_marginStart=&quot;29dp&quot;
          android:layout_marginTop=&quot;29dp&quot;
          android:layout_marginEnd=&quot;65dp&quot;
          android:layout_marginBottom=&quot;65dp&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintEnd_toStartOf=&quot;@+id/bar_code_scan&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toBottomOf=&quot;@+id/barcode_detail&quot; /&gt;
  
      &lt;com.google.android.material.floatingactionbutton.FloatingActionButton
          android:id=&quot;@+id/bar_code_scan&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginBottom=&quot;10dp&quot;
          android:clickable=&quot;true&quot;
          android:focusable=&quot;true&quot;
          android:visibility=&quot;invisible&quot;
          app:layout_constraintBottom_toTopOf=&quot;@+id/fruit_scan&quot;
          app:layout_constraintEnd_toEndOf=&quot;@+id/fruit_scan&quot;
          app:srcCompat=&quot;@drawable/ic_barcode_scan&quot; /&gt;
  
      &lt;com.google.android.material.floatingactionbutton.FloatingActionButton
          android:id=&quot;@+id/scanButton&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginStart=&quot;339dp&quot;
          android:layout_marginEnd=&quot;16dp&quot;
          android:layout_marginBottom=&quot;16dp&quot;
          android:clickable=&quot;true&quot;
          android:contentDescription=&quot;TODO&quot;
          android:focusable=&quot;true&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintHorizontal_bias=&quot;0.0&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:srcCompat=&quot;@drawable/ic_baseline_add_24&quot; /&gt;
  
      &lt;com.google.android.material.floatingactionbutton.FloatingActionButton
          android:id=&quot;@+id/fruit_scan&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginBottom=&quot;10dp&quot;
          android:clickable=&quot;true&quot;
          android:focusable=&quot;true&quot;
          android:visibility=&quot;invisible&quot;
          app:layout_constraintBottom_toTopOf=&quot;@+id/scanButton&quot;
          app:layout_constraintEnd_toEndOf=&quot;@+id/scanButton&quot;
          app:srcCompat=&quot;@drawable/ic_vegetable_scan&quot; /&gt;
  
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p><strong>JAVA CODE (A subset of the oncreate function)</strong></p>
  <pre><code>final ArrayList&lt;String&gt; dat = new ArrayList&lt;&gt;();
          final FirebaseUser users = firebaseAuth.getCurrentUser();
          String result = users.getEmail().replace(&quot;.&quot;,&quot;&quot;);
          DatabaseReference databaseReference2 = FirebaseDatabase.getInstance().getReference().child(&quot;Users&quot;).child(result).child(&quot;January&quot;).child(&quot;Product&quot;);
          databaseReference2.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                  for(DataSnapshot snapshot : dataSnapshot.getChildren()){
                      dat.add(snapshot.child(&quot;productname&quot;).getValue().toString());
                  }
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError error) {
  
              }
          });
          ArrayAdapter arrayAdapter = new ArrayAdapter(current_month.this, android.R.layout.simple_list_item_1,dat);
          barcode_detail.setAdapter(arrayAdapter);
  </code></pre>