title: How to print Firebase data in a listview in Android?
body: <p>I am trying to retrieve Firebase values into a list view in my app.</p>
  
  <p>I have a database structure like this. <a href="https://i.stack.imgur.com/2tRJ1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2tRJ1.png" alt="my database structure"></a></p>
  
  <p>When I run the code, in my app I see an empty page, but in my Android Studio console I see a <strong>System.out: dsdstytytyty</strong> which is the last value on that structure. I added those values manually out of curiosity.</p>
  
  <p>My questions</p>
  
  <ol>
  <li>Why does my code only detect the last two values amount and item?</li>
  <li>Why does it print them in the Android Studio console and not in my app?</li>
  <li>Does the unique identifier which acts as a title to the Dog Expenditure child play a role in this?</li>
  </ol>
  
  <p>Code for retrieving the values.</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_mystatement);
          listview = (ListView) findViewById(R.id.listview);
          adapter=new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_dropdown_item_1line,list);
          listview.setAdapter(adapter);
          dref= FirebaseDatabase.getInstance().getReference();
          dref= dref.child("Dog Expenditure");
  
          dref.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  for(DataSnapshot child : dataSnapshot.getChildren()) {
  HashMap&lt;String, String&gt; value = (HashMap&lt;String, String&gt;) child.getValue();
                      String amount = child.get("amount").toString();
                      String item = value.get("item").toString();
                      // This will print out amount and item
                      System.out.println(amount + item);
                  }
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
  
              }
          });
          }
  </code></pre>
  
  <p>Even when I try to do a <strong>System.out.println("Test letters to see if it would output in my app");</strong> nothing happens just a blank page shows.</p>