Using 1 login screen activity for different activities on Android Studio : i'm currently developing an Android app in Android Studio and i'm trying to use only one login screen for two different screens instead of using two login screens which will use the phone memory more. 
I tried using if and else statements where if button 1 was clicked then send to screen 1. 
Below is my code: 

    public void userLogin() {

        String userEmail = email.getText().toString();
        String userPass = password.getText().toString();
        
        if(TextUtils.isEmpty(userEmail)){
            Toast.makeText(LoginActivity.this, "Please Enter Email", Toast.LENGTH_SHORT).show();
        }

        if(TextUtils.isEmpty(userPass)){
            Toast.makeText(LoginActivity.this, "Please Enter Password", Toast.LENGTH_SHORT).show();
        }


        auth.signInWithEmailAndPassword(userEmail, userPass)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        if(task.isSuccessful()){
                            progressDialog.dismiss();
                            finish();
                            if (mainactivity.type == 1) {
                                Toast.makeText(LoginActivity.this, "Login Successful", Toast.LENGTH_SHORT).show();
                                startActivity(new Intent(LoginActivity.this, EmployeeActivity.class));
                            }
                            if(mainactivity.type == 2){
                                Toast.makeText(LoginActivity.this, "Login Successful", Toast.LENGTH_SHORT).show();
                                startActivity(new Intent(LoginActivity.this, AdminActivity.class));
                            }
                        }else{
                            Toast.makeText(LoginActivity.this, "ERROR: Invalid Email or Password", Toast.LENGTH_SHORT).show();
                            progressDialog.dismiss();
                        }
                        }

                    });
                }

Any help would be much appreciated as i'm totally new to app development. 