title: Why can't this Android app cast text from Firebase into strings?
body: <p>I made a simple Android app that is supposed to display text from Firebase. Yet, I have an issue converting Firebase data into strings. Here is the code: </p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
    private Firebase ref;
  
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Firebase.setAndroidContext(this);
      Firebase ref = new Firebase("xxx");
      final TextView textbox = (TextView) findViewById(R.id.textbox);
      Firebase.setAndroidContext(this);
      ref.addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              String newCon = (String) dataSnapshot.getValue();
              textbox.setText(newCon);
          }
  
          @Override
          public void onCancelled(FirebaseError firebaseError) {
  
          }
      });
    }
  }
  </code></pre>
  
  <p>I get these errors: </p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
  java.lang.ClassCastException: java.util.HashMap cannot be cast to java.lang.String
  at com.example.elish_000.myfirstapp.MainActivity$1.onDataChange(MainActivity.java:43)
  </code></pre>
  
  <p>There are no errors when I run the app. Yet, when I add text to Firebase the app crashes instead of displaying the text.</p>