title: Firebase - Display to ListView
body: <p>I have data stored on firebase which has a film id as the child and within it contains the film name. I want to display the film names stored on firebase within a ListView. The problem I am having is that I am unsure how to get only the data of the film name rather than all the data including the user. I am also uploading the data from one activity and want to display it in another activity within the ListView.</p>
  <p><img src="https://i.stack.imgur.com/4LxGe.png" alt="Firebase Database" /></p>
  <p><img src="https://i.stack.imgur.com/NZPhX.png" alt="How it currently displays" /></p>
  <p><strong>Upload to Firebase</strong></p>
  <pre><code>String filmID = filmDetails.getString(&quot;film_id&quot;);
  String filmName = filmDetails.getString(&quot;film_name&quot;);
  DatabaseReference currentUserDBR = FirebaseDatabase.getInstance().getReference().child(&quot;Users&quot;).child(currentUserID);
  
  if (currentUserID != null) {
  
  currentUserDBR.orderByChild(filmID).addListenerForSingleValueEvent(new ValueEventListener() {
      @Override
      public void onDataChange(@NonNull DataSnapshot snapshot) {
          String fbFilmID = snapshot.getValue().toString();
          if (fbFilmID.contains(filmID)) { // If film already exists Remove it on click
              btnSaved.setText(&quot;Add to List&quot;);
              currentUserDBR.child(filmID).removeValue();
              Toast.makeText(getApplicationContext(), &quot;Removed from Films List&quot;, Toast.LENGTH_SHORT).show();
          } else { // If film does not exist add it on click
              btnSaved.setText(&quot;Remove&quot;);
              currentUserDBR.child(filmID).child(&quot;Film Name&quot;).setValue(filmName);
              Toast.makeText(getApplicationContext(), &quot;Saved to Films List&quot;, Toast.LENGTH_SHORT).show();
              overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
          }
      }
  
  </code></pre>
  <p><strong>Display to ListView</strong></p>
  <pre><code>DatabaseReference filmsReference = FirebaseDatabase.getInstance().getReference( &quot;Users&quot;);
  lvSavedFilms = findViewById(R.id.lv_display_saved_films);
  final ArrayAdapter&lt;String&gt; arrayAdapter = new ArrayAdapter&lt;&gt;(this, R.layout.listitem, R.id.lv_text_color, filmName);
  lvSavedFilms.setAdapter(arrayAdapter);
  
  ChildEventListener childEventListener = filmsReference.addChildEventListener(new ChildEventListener() {
              @Override
              public void onChildAdded(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
  /*                GenericTypeIndicator&lt;HashMap&lt;String, Object&gt;&gt; genericTypeIndicator = new GenericTypeIndicator&lt;HashMap&lt;String, Object&gt;&gt;() {
                  };
                  HashMap&lt;String, Object&gt; hmFilmName = snapshot.getValue(genericTypeIndicator);*/
                  String value = snapshot.getValue().toString();
                  filmName.add(value);
  
                  arrayAdapter.notifyDataSetChanged();
              }
  
              @Override
              public void onChildChanged(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
  
              }
  
              @Override
              public void onChildRemoved(@NonNull DataSnapshot snapshot) {
                  arrayAdapter.remove(arrayAdapter.getItem(filmName.indexOf(snapshot.getValue(String.class))));
                  arrayAdapter.notifyDataSetChanged();
              }
  
              @Override
              public void onChildMoved(@NonNull DataSnapshot snapshot, @Nullable String previousChildName) {
  
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError error) {
  
              }
  
          });
  </code></pre>
  <p>I tried <code>String value = snapshot.getValue(String.class);</code> but I got an error saying it couldnt convert HashMap to String.</p>