private void LoginUser(final String email,final String password) {
    mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(task -> {
        if (task.isSuccessful()) {
            String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();
            DatabaseReference mRootRef = FirebaseDatabase.getInstance("https://fyp2-darren-default-rtdb.asia-southeast1.firebasedatabase.app").getReference();
            mRootRef.child("Users").child(uid).child("User Information").addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                    if(dataSnapshot.child("userType").getValue(String.class).equals("admin")) {
                        Toast.makeText(LogInActivity.this, "LogIn successful", Toast.LENGTH_LONG).show();
                        Intent intent = new Intent(LogInActivity.this, AdminMainPageActivity.class);
                        startActivity(new Intent(getApplicationContext(), AdminMainPageActivity.class));
                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        startActivity(intent);
                    } else if (dataSnapshot.child("userType").getValue(String.class).equals("users")) {
                        Toast.makeText(LogInActivity.this, "LogIn successful", Toast.LENGTH_LONG).show();
                        Intent intent = new Intent(LogInActivity.this, HomePage.class);
                        startActivity(new Intent(getApplicationContext(), AdminMainPageActivity.class));
                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK |Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        startActivity(intent);
                        // startActivity(new Intent(getApplicationContext(), PatientMainPageActivity.class));
                    }
                }
LogInActivity$2.onDataChange(LogInActivity.java:86)
A few days ago this login still worked, but recently I tried to login with a new account and this happened.
 
     
    