title: Add Objects to custom listView with Firebase
body: <p>I want to add an whole object to my listview using Firebase.
  Have been illustration this with a image because sometimes an image is just easier than text.</p>
  
  <p><a href="https://i.stack.imgur.com/w4eiX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w4eiX.png" alt="Firebase database tree"></a></p>
  
  <p>Firebase tutorials show how to return each child as an item and display it with Firebase UI and I want to almost do the same thing but the difference is that I want the whole object to be the child and the childs inside that object will be additional information for each listitem.</p>
  
  <p>So in my image I have object <strong>Camping</strong> and the "Mountains",  "Nature", "Place".
  In an custom listView I want the different values be set to textViews.to be the </p>
  
  <p>This is how I get the child items with the Firebase UI:</p>
  
  <pre><code>protected void onStart(){
      super.onStart();
      Firebase items = rootRef.child("events");
      final FirebaseListAdapter&lt;String&gt; fireAdapter = new FirebaseListAdapter&lt;String&gt;(
              this,String.class,R.layout.list_item,items) {
          @Override
          protected void populateView(View view, String s, int i) {
              TextView testText = (TextView)view.findViewById(R.id.textView2);
              testText.setText(s);
              trucks.add(s);
          }
      };
      listView.setAdapter(fireAdapter);
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <blockquote>
    <blockquote>
      <p>Here is code how I get <strong>mountains</strong> value to be set to a textview in my custom listview layout:</p>
    </blockquote>
  </blockquote>
  
  <pre><code>private void getUpdatesEvents(DataSnapshot dataSnapshotRoot){
      events.clear();
      for(DataSnapshot dataSnapshot : dataSnapshotRoot.getChildren()){
          Events e = new Events();
          e.setName(dataSnapshot.getValue(Events.class).getName());
          events.add(e.getName());
      }
      if(events.size()&gt;0){
          ArrayAdapter adapter = new ArrayAdapter(this,R.layout.list_item,R.id.textView2,events);
          listView.setAdapter(adapter);
      }
      else{
          Toast.makeText(this,"There is no data",Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>