title: Firebase ListView
body: <pre><code>n = ref.child(key).child("customer");
  
  n.addChildEventListener(new ChildEventListener() {
      @Override
      public void onChildAdded(DataSnapshot dataSnapshot, String s) {
          getData(dataSnapshot);
      }
  
      @Override
      public void onChildChanged(DataSnapshot dataSnapshot, String s) {
          getData(dataSnapshot);
      }
  
      public void onChildRemoved(DataSnapshot dataSnapshot) { }
      public void onChildMoved(DataSnapshot dataSnapshot, String s) { }
      public void onCancelled(FirebaseError firebaseError) { }
  });
  </code></pre>
  
  <p>And the <code>getData</code> function looks like this. </p>
  
  <pre><code>private void getData(DataSnapshot ds){
    arrayList.clear();
    for(DataSnapshot data:ds.getChildren()){
      People p = new People();
      p.setName(data.getValue(People.class).getName());
      arrayList.add(p.getName());
    }
  
    if(arrayList.size()&gt;0){
      ArrayAdapter a = new ArrayAdapter(MainActivity.this,android.R.layout.simple_list_item_1,arrayList);
      listview.setAdapter(a);
    }
  }
  </code></pre>
  
  <p>It's showing</p>
  
  <blockquote>
    <p>Unfortunate error and closing the program (App crashes)</p>
  </blockquote>
  
  <p>Where did I go wrong? Under the customer key there are a number of unique keys generated by push, I want to get the inside data (names) in the <code>ListView</code>.</p>
  
  <p>Here's my logcat</p>
  
  <pre><code>PID: 2906 com.firebase.client.FirebaseException: Failed to bounce to type at com.firebase.client.DataSnapshot.getValue(DataSnapshot.java:‌​185 at com.example.ahmedimam.firebase2.MainActivity.getData(MainAct‌​ivity.java:151)
  </code></pre>
  
  <p>MainActivity 151 points out to</p>
  
  <pre><code>p.setName(data.getValue(People.class).getName());
  </code></pre>
  
  <p>If I change it to <code>p.setName(data.getValue().toString);</code> - its working but it shows the last added key with full children and I want to get the name only of every auto generated key..</p>