title: how to differentiate it was signed in as customer or captain/driver
body: <p>i'm using firebase to login to my app there are two users customer and driver .i log in as driver/captain after app restart without asking for sign in as customer or driver it moves to customer side.just because of user.getInstance()
  how to differenciate how was signed in first </p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_customer_login);
  
  
          nAuth= FirebaseAuth.getInstance();
          firebaseAuthListener= new FirebaseAuth.AuthStateListener() {
              @Override
              public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                  FirebaseUser user =FirebaseAuth.getInstance().getCurrentUser();
                  if(user!=null){
                      Intent intent= new Intent(CustomerLoginActivity.this, CustomerMapActivity.class);
                      startActivity(intent);
  
  
  
                  }
  
              }
          };
  
          nEmail= findViewById(R.id.email);
          nPassword= findViewById(R.id.password);
          nLogIn= findViewById(R.id.login);
          new_user= findViewById(R.id.new_user);
          new_user.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                 if(user_Type=="Customer") {
                      final String email = nEmail.getText().toString();
                      final String password = nPassword.getText().toString();
                      nAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(CustomerLoginActivity.this, new OnCompleteListener&lt;AuthResult&gt;() {
                          @Override
                          public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                              if (!task.isSuccessful()) {
                                  Toast.makeText(CustomerLoginActivity.this, "Sign Up Error", Toast.LENGTH_SHORT).show();
                              } else {
                                  String user_id = nAuth.getCurrentUser().getUid();
                                  DatabaseReference current_user_db = FirebaseDatabase.getInstance().getReference().child("Users").child("Customers").child(user_id);
                                  current_user_db.setValue(true);
                              }
                          }
                      });
                  }else if(user_Type=="Captain"){
                      final String email =  nEmail.getText().toString();
                      final String password =  nPassword.getText().toString();
                      nAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(CustomerLoginActivity.this, new OnCompleteListener&lt;AuthResult&gt;() {
                          @Override
                          public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                              if(!task.isSuccessful()){
                                  Toast.makeText(CustomerLoginActivity.this , "Sign Up Error", Toast.LENGTH_SHORT).show();
                              }else{
                                  String user_id= nAuth.getCurrentUser().getUid();
                                  DatabaseReference current_user_db = FirebaseDatabase.getInstance().getReference().child("Users").child("Drivers").child(user_id);
                                  current_user_db.setValue(true);
                              }
                  }
              });
                  }else {
  
                      Toast.makeText(CustomerLoginActivity.this , "Select Any User Type", Toast.LENGTH_SHORT).show();
  
                  }
  
              }
          });
          nLogIn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                  if (user_Type=="Customer") {
                      final String email = nEmail.getText().toString();
                      final String password = nPassword.getText().toString();
                      nAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(CustomerLoginActivity.this, new OnCompleteListener&lt;AuthResult&gt;() {
                          @Override
                          public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                              if (!task.isSuccessful()) {
                                  Toast.makeText(CustomerLoginActivity.this, "Sign Up Error", Toast.LENGTH_SHORT).show();
                              }
  
                          }
                      });
                  }
                  else if(user_Type=="Captain"){
  
  
                      final String email =  nEmail.getText().toString();
                      final String password =  nPassword.getText().toString();
                      nAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(CustomerLoginActivity.this, new OnCompleteListener&lt;AuthResult&gt;() {
                          @Override
                          public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                              if(!task.isSuccessful()){
                                  Toast.makeText(CustomerLoginActivity.this , "Sign Up Error", Toast.LENGTH_SHORT).show();
                              }
  
                          }
                      });
                  }else {
                      Toast.makeText(CustomerLoginActivity.this , "Select Any User Type", Toast.LENGTH_SHORT).show();
  
                  }
              }
          });
  
  </code></pre>
  
  <p>actually using that email registered as captain but it login as customer too</p>