title: Firebase list child in listview
body: <p>I'm new to Firebase, and I need to show a child info on a listview. It adds the data, but it does not show on listview and the app crashes. No error is shown on log, but on firebase crash I have this error:</p>
  
  <pre><code>Exception com.google.firebase.database.DatabaseException: Failed to convert value of type java.util.HashMap to String
  com.google.android.gms.internal.zzamy.zzcg ()
  com.google.android.gms.internal.zzamy.zzb ()
  com.google.android.gms.internal.zzamy.zza ()
  com.google.firebase.database.DataSnapshot.getValue ()
  br.com.imobapp.CorretorFragment$1.onChildAdded (CorretorFragment.java:58)
  com.google.android.gms.internal.zzaip.zza ()
  com.google.android.gms.internal.zzakp.zzcxi ()
  com.google.android.gms.internal.zzaks$1.run ()
  android.os.Handler.handleCallback (Handler.java:739)
  android.os.Handler.dispatchMessage (Handler.java:95)
  android.os.Looper.loop (Looper.java:145)
  android.app.ActivityThread.main (ActivityThread.java:5832)
  </code></pre>
  
  <p>My data is like this (Sorry, can't post pics since my account is new, only the link):</p>
  
  <p><a href="https://i.stack.imgur.com/lZHFC.jpg" rel="nofollow noreferrer">https://i.stack.imgur.com/lZHFC.jpg</a></p>
  
  <p>My model is:</p>
  
  <pre><code>import com.google.firebase.database.IgnoreExtraProperties;
  
  @IgnoreExtraProperties
  public class ModelCorretor {
      private String CorNome;
      private String CorCreci;
  
  
      public ModelCorretor(){
  
      };
  
      public ModelCorretor(String CorNome, String CorCreci){
  
          this.CorNome = CorNome;
          this.CorCreci = CorCreci;
  
      };
  
      public String getCorNome() {
          return CorNome;
      }
  
      public void setCorNome(String corNome) {
          CorNome = corNome;
      }
  
      public String getCorCreci() {
          return CorCreci;
      }
  
      public void setCorCreci(String corCreci) {
          CorCreci = corCreci;
      }
  }
  </code></pre>
  
  <p>And my fragment for showing it on listview:</p>
  
  <pre><code>import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.ImageButton;
  import android.widget.ListView;
  
  import com.google.firebase.database.ChildEventListener;
  import com.google.firebase.database.DataSnapshot;
  import com.google.firebase.database.DatabaseError;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  
  import java.util.ArrayList;
  
  import static android.content.ContentValues.TAG;
  
  
  public class CorretorFragment extends Fragment implements View.OnClickListener {
  
      public CorretorFragment() {
          // Required empty public constructor
      }
  
      ImageButton btAddCor, btSearchCor;
      ListView lvCorretor;
      DatabaseReference dref;
      ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;();
      ArrayAdapter&lt;String&gt; adapter;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
  
          View view = inflater.inflate(R.layout.fragment_corretor, container, false);
          btAddCor =(ImageButton)view.findViewById(R.id.btAddCor);
          btAddCor.setOnClickListener(this);
          btSearchCor =(ImageButton)view.findViewById(R.id.btSearchCor);
          btSearchCor.setOnClickListener(this);
          lvCorretor = (ListView)view.findViewById(R.id.lvCorretor);
          adapter = new ArrayAdapter&lt;String&gt;(getContext(), android.R.layout.simple_dropdown_item_1line, list);
          lvCorretor.setAdapter(adapter);
  
          dref = FirebaseDatabase.getInstance().getReference().child("Corretores");
          dref.addChildEventListener(new ChildEventListener() {
              @Override
              // Read from the database
              public void onChildAdded(DataSnapshot dataSnapshot, String s) {
                  String value = dataSnapshot.getValue(String.class);
                  list.add(value);
                  adapter.notifyDataSetChanged();
              }
  
              @Override
              public void onChildChanged(DataSnapshot dataSnapshot, String s) {
                  // This method is called once with the initial value and again
                  // whenever data at this location is updated.
              }
  
              @Override
              public void onChildRemoved(DataSnapshot dataSnapshot) {
                  String value = dataSnapshot.getValue(String.class);
                  list.remove(value);
                  adapter.notifyDataSetChanged();
              }
  
              @Override
              public void onChildMoved(DataSnapshot dataSnapshot, String s) {
  
              }
  
              @Override
              public void onCancelled(DatabaseError  error) {
                  // Failed to read value
                  Log.w(TAG, "Failed to read value.", error.toException());
              }
          });
  
  
  
  
          return view;
      }
  
  
          @Override
          public void onClick(View view){
          MainActivity activity = (MainActivity)getActivity();
              switch(view.getId()){
  
                  case R.id.btAddCor:
                      activity.chamaAddCor();
                      break;
                  case R.id.btSearchCor:
                      activity.chamaSearchCor();
                      break;
                  default: throw new RuntimeException("unreachable");
  
              }
          }
  }
  </code></pre>
  
  <p>If any more code is needed or if I did something wrong in the question, please let me know.
  I have an idea that I have to set a child for it to show, like I did in <code>FirebaseDatabase.getInstance().getReference().child("Corretores");</code> but I tried a lot and have no clue how to do it on the <code>onChildAdded</code>.</p>