title: onDataChange method did not work in android studio
body: <p>I working on an Android studio application and I used a Firebase real-time database. And I have a problem and ask for help.. The table name in the database is <code>Hospital</code> and the properties are <code>hospital_name</code>,<code>hospital_code</code>,<code>hospital_password</code>,<code>hospital_phone</code>,<code>hospital_email</code>.</p>
  
  <p>The information added successfully but the problem that I could not retrieve the information from the database (hospital name and hospital code) and I searched and used different ways, but still the problem exist. The should code retrieve the information from <code>Hospital</code> table and show it in the application.</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity  {
      TextView reg;
  
      EditText email,password;
      Button loginBt;
      Database db;
      String emailString,passwordString;
      TextView regText;
      TextView name,code;
      private DatabaseReference ref;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          ref = FirebaseDatabase.getInstance().getReference().child("Hospital").child("ABA");
          db = new Database();
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          email = (EditText) findViewById(R.id.logInEmail);
          password = (EditText) findViewById(R.id.passwordLogin);
          regText = (TextView) findViewById(R.id.reg_text);
          loginBt = (Button) findViewById(R.id.logInButton);
         /* loginBt.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  login();
              }
          });*/
          regText.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  createAccount();
              }
          });
          name = (TextView) findViewById(R.id.hospitalNameMain);
          code = (TextView) findViewById(R.id.hospitalCodeMain);
          loginBt.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  show();
              }
          });
  
  
      }
  
      private void show() {
  
          ref = FirebaseDatabase.getInstance().getReference().child("Hospital").child("QCH");
          ref.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  Toast.makeText(MainActivity.this,"log in ",Toast.LENGTH_SHORT).show();
                  String hospitalName = dataSnapshot.child("hospital_name").getValue().toString();
                  String hospitalCode = dataSnapshot.child("hospital_code").getValue().toString();
                  name.setText(hospitalName);
                  code.setText(hospitalCode);
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
  
              }
          });
  
      }
  
      private void createAccount() {
          Intent i = new Intent(this, RegistrationActivity.class);
          startActivity(i);
      }
  }
  </code></pre>
  
  <p>Database Structure: </p>
  
  <p><a href="https://i.stack.imgur.com/6kVlE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6kVlE.png" alt="enter image description here"></a></p>