Android Login Window Complete Example

397

Overview

In all Android app, the login must be required for authentication. In this article, we explain the Android Login Window Complete example. The login window consists of credentials when wrong attempted are made. The login window is same like twitter and facebook.

Introduction

Login button when user will enter the username and password in a text field and click on the login button. Its show the message please register first if you are a new user and not registered till yet.

Register button in which the user will perform the registration process. The registration process consists of the username, password, confirm the password, country name, and gender recognization and term and condition. When you will enter the necessary information and click the registration button. You will see the message you have registered.

Clear button The clear button clears the editText field. When the user types the wrong information.

Prerequisite

It will good to cover my previous articles before this. Its help to learn more about Android development. In which I explained  Radio and Toggle button in Android and How can create checkbox and spinner in android?

Create a new Layout
->Right click> the ->layout folder-> select ->New option->and ->click ><-layout resource folder-> and<-After the layout is created>

This layout code consists of one textView two editText fields three buttons. The two editText fields for user response like username and password and three buttons which are login button registration button and the clear button. The registration button, you will complete a registration process and the clear button which clears the textField.

<Paste the following code>

File:activity_main.xml.

Create a new Layout
->Right click> the ->layout folder-> select ->New option->and ->click ><-layout resource folder-> and<-After the layout is created>

The following layout code consists of the registration process. This activity contains three editText fields username password and confirms password and two radio button which recognized the gender description Male and Female and one checkbox agree on the term and condition and registration button.

<Paste the following code>

File:singn.xml.

Create a new Layout
->Right click> the ->layout folder-> select ->New option->and ->click ><-layout resource folder-> and<-After the layout is created>

The following layout code contain two textView. When user are registred and login a welome screen are show.

<Paste the following code>

File:welcome.xml.

Create a new Layout
->Right click> the ->layout folder-> select ->New option->and ->click ><-layout resource folder-> and<-After the layout is created>
<Paste the following code>

File:Second.xml.

AndroidManifest
<Paste the following code>

File:AndroidManifest.xml file.

Create a new Class

Create new class ->Right click-> the ->package name ->select ->New option-> and click-> java class <-Create new class ->.
<Paste the following code on an activity that host the layout>

            FirstActivity name is File: ( Second.java)

Create a new Class

Create new class ->Right click-> the ->package name ->select ->New option-> and click-> java class <-Create new class ->.
<Paste the following code on an activity that host the layout>

SecondActivity name is File: ( Second.java)

Create a new Class

Create new class ->Right click-> the ->package name ->select ->New option-> and click-> java class <-Create new class ->.
<Paste the following code on an activity that host the layout>

ThirdActivity name is File: ( AppUtils.java)

Create a new Class

Create new class ->Right click-> the ->package name ->select ->New option-> and click-> java class <-Create new class ->.
<Paste the following code on an activity that host the layout>

fourthActivity name is  File: ( AppUtils.java)

Create a new Class

Create new class ->Right click-> the ->package name ->select ->New option-> and click-> java class <-Create new class ->.
<Paste the following code on an activity that host the layout>

                                  the fifth activity name is equally File: (Contstans.java)

Create a new Class

Create new class ->Right click-> the ->package name ->select ->New option-> and click-> java class <-Create new class ->.
<Paste the following code on an activity that hosts the layout>

The sixth activity name is equally File: (WelComeActivity.java)

Let you ran the application, just click on toolbar find the option <Run>click on it. But if you are a new user. A message on activity is shown “please register first”. First, you will write information like username and password. But you miss the value in one of these filed its show the message”Enter the username”.

Alt tag android login window

The following is the registration activity before you will log-in to write all the necessary information. The information consists of three text fields username, password and confirms the password, two radio button, and one checkbox. You will write the username like ABC password 123 if you wrote the wrong information in confirm password like12345 its show message please correct the password. After that, you will select the gender male or female. click on the register button. The two remaining options are their country name and term and condition also fill it.

Alt tag android login window

When you are registered. you will write the same username’ ABC ‘ and password  ‘123’ any other you want to write on that. After that, you will click the login button. A new activity will be open. A text message was written on its “welcome to the new activity” with username and password. The following is the output.

Alt tag android login window

Conclusion

I wish I could tell you that a great site. You just understand the key element above postAndroid Login Window Complete. More, detail about About more detail.Hope you got the idea. please share it. If you find any mistake or confusion please Commit on reply section.