What lines of code can in include in my class so as to have a validation technique for both email and password?

What lines of code can in include in my class so as to have a validation technique for both email and password?

I have written the following lines of code and i need to include an error validation check in it for both Email and Password. The output on the screen upon a wrong mail/password entry should be in the form of a Toast.makeText() format. So here is the code below

I have written the following lines of code and i need to include an error validation check in it for both Email and Password. The output on the screen upon a wrong mail/password entry should be in the form of a Toast.makeText() format. So here is the code below

public class MainActivity extends AppCompatActivity implements View.OnClickListener { public void clickRegister(View view) {

    startActivity(new Intent(MainActivity.this, RegisterActivity.class));

}

private Button buttonSignin;
private EditText emailAdd;
private EditText passAdd;
private FirebaseAuth firebaseAuth;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    firebaseAuth=FirebaseAuth.getInstance();
    if(firebaseAuth.getCurrentUser()!=null){
        //Remote control activity
        finish();
        startActivity(new Intent(getApplicationContext(),RemoteControl.class));
    }
    buttonSignin = (Button) findViewById(R.id.logIn);
    emailAdd = (EditText) findViewById(R.id.emailAddress);
    passAdd = (EditText) findViewById(R.id.passWord);

    buttonSignin.setOnClickListener(this);


}

private void userLogin(){ String email=emailAdd.getText().toString().trim(); String password=passAdd.getText().toString().trim(); if(TextUtils.isEmpty(email)){ //Email is empty! Toast.makeText(this,"Please Enter Email",Toast.LENGTH_SHORT).show(); //Stop function from executing further return; }

if (TextUtils.isEmpty(password))
{
    //Password is empty
    Toast.makeText(this,"Please Enter Password",Toast.LENGTH_SHORT).show();
    return;
}


firebaseAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
    @Override
    public void onComplete(@NonNull Task<AuthResult> task) {
        if(task.isSuccessful()){
            //start profile activity
            finish();
            startActivity(new Intent(getApplicationContext(),RemoteControl.class));
        }
    }
});

} @Override public void onClick(View view) { if(view==buttonSignin) { userLogin(); }

}

}

I expect an output of "Incorrect Email" and "Incorrect password" for each line of bad entry in the form of a Toast.maketext()

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Java Fundamentals: Learn Java for absolute beginners |Simpliv

Java Fundamentals: Learn Java for absolute beginners

Java Essentials : Learn Core Java From Basic to Advance

Learn Java Programming Using Practical Assignments. Start Building Back-end Web Applications Robust Test Automation Frameworks By End Of The Course. Learn More!

Android App Development Company in UAE

Have a plan to build an robust Android App Development with multiple features? We at Data EximIT is one of the best **[Android App Development Company in UAE](https://www.dataeximit.com/android-application-development/ "Android App Development...