title: java.lang.String cannot be cast to java.util.HashMap Error
body: <p>I have the following code trying  to retrieve firebase values. My database structure is as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/QXCwH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QXCwH.png" alt="enter image description here"></a></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, Object&gt; value = (HashMap&lt;String, Object&gt;) child.getValue();
                  String amount = value.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>I have tried different ways to do this but i do not just get any luck here..All i get is this error <strong>java.lang.ClassCastException: java.lang.String cannot be cast to java.util.HashMap
  at com.example.moses.farm.Mystatement$1.onDataChange(Mystatement.java:39)</strong> which points to this <strong>HashMap value = (HashMap) child.getValue();</strong> line of code. I have been stuck here for almost a week, anyone with an idea of how to get this will truly help me</p>