title: Android, Firebase - Displaying right activity for user
body: <p>I have two usertypes in my application. I am using Firebase realtime database to store username and usertype without using Firebase Authentication. My database:</p>
  
  <pre><code>User
   Unique ID
    username: John
    usertype: Teacher
  </code></pre>
  
  <p>My questions is how I can send the user to a activity based on the usertype. I thought i could do something like this:</p>
  
  <pre><code>database.addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              if(dataSnapshot.child("usertype").equals("Teacher") ){
                  Intent intent = new Intent(MainActivity.this, SecondActivity.class);
                  startActivity(intent);
              } else {
                 Intent intent = new Intent(MainActivity.this, ThirdActivity.class);
                 startActivity(intent);
              }
          }
  </code></pre>
  
  <p>But this does not seem to work, as it always goes to the ThirdActivity. Any suggestions?</p>