Thursday , January 13 2022

Android Firebase Tutorial – User Registration with Authentication – Android Coding by DMTechnolab

The package The trap.Simplified coding.Agnabashodhimdev;

Import Android.App.Progressressialog;

Import Android.Support.Annotation.No no;

Import Android.Support.v7.App.AppCompatActivity;

Import Android..Bundle;

Import Android.The text.Textulates;

Import Android.Opinion.Opinion;

Import Android.Widget.switch;

Import Android.Widget.Change in writing;

Import Android.Widget.Toast;

Import With.Google.Android.Village.Work.OnCompleteListener;

Import With.Google.Android.Village.Work.Work;

Import With.Google.Fire.Justification.Authentic;

Import With.Google.Fire.Justification.FirebaseAuth;

public class Main activity Is spread AppCompatActivity To apply Opinion.OnClickListener {{

// Defining visual objects

Private Change in writing editTextEmail;

Private Change in writing editTextPassword;

Private switch buttonSignup;

Private Progressressialog PragatiDialogue;

// defining firebusbag object

Private FirebaseAuth firebaseAuth;

@Override

Protected Zero Go ahead()Bundle saveInstanceState) {{

Super.Go ahead()saveInstanceState);

setContentView()R.Layout.activity_main);

// Initializing Firebase Ortic Object

firebaseAuth = FirebaseAuth.get Instance());

// initial idea

editTextEmail = ()Change in writing) findViewById()R.Id.editTextEmail);

editTextPassword = ()Change in writing) findViewById()R.Id.editTextPassword);

buttonSignup = ()switch) findViewById()R.Id.buttonSignup);

PragatiDialogue = New Progressressialog()this);

// connect the listener to the button

buttonSignup.setOnClickListener()this);

}

Private Zero Registrar()){{

// Receiving emails and passwords from editing texts

String E-mail = editTextEmail.Gettext()).Wire()).Trim());

String Password = editTextPassword.Gettext()).Wire()).Trim());

// checking if email and password are empty

If()Textulates.Is Empty()E-mail)){{

Toast.Makeup()this,“Please enter email”,Toast.LENGTH_LONG).Display());

The return;

}

If()Textulates.Is Empty()Password)){{

Toast.Makeup()this,“Please fill the password”,Toast.LENGTH_LONG).Display());

The return;

}

// If email and password are not empty

// Displaying a progress dialog

PragatiDialogue.Set message()“please wait …”);

PragatiDialogue.Display());

// Creating a new user

firebaseAuth.createUserWithEmailAndPassword()E-mail, Password)

.addOnCompleteListener()this, New OnCompleteListener()) {{

@Override

public Zero That which has been completed()@Nonal Work Work) {{

// check if success

If()Work.Is successful())){{

// display some message here

Toast.Makeup()Main activity.this,“successfully registered”,Toast.LENGTH_LONG).Display());

}other{{

// display some message here

Toast.Makeup()Main activity.this,“Registration Error”,Toast.LENGTH_LONG).Display());

}

PragatiDialogue.reject());

}

});

}

@Override

public Zero on click()Opinion Opinion) {{

// call register method click

Registrar());

}

}


Source link

About dmtechnolab

Check Also

Simplified Coding

Android Espresso Tutorial – Testing Fragment in Isolation – Android Coding by DMTechnolab

Welcome to another tutorial in the Android test series. And this post is called Android …

Leave a Reply

Your email address will not be published. Required fields are marked *