Login Request Example In Android

This example shows how to create and handle login form in android.


1.) Create a new project by File-> New -> Android Project name it LoginRequestExample.

2.) Write following into main.xml:




3.) Run for output.


1.) Create a project named LoginRequestExample and set the information as stated in the image.

Build Target: Android 4.0
Application Name: LoginRequestExample
Package Name: com. example. LoginRequestExample
Activity Name: LoginRequestExample
Min SDK Version: 11

2.) Open LoginRequestExample.java file and write following code there:




3.) Compile and build the project.


Leave a Comment:

Roney K Joseph says November 16, 2012

Your tutorials are very simple and superb

Thank you

DEEPAK GOYAL says November 24, 2012


Vijaya says December 11, 2012

My Requirement is Login Example, I wanna enter constant username and password for login, if any one enter with empty it will also login to page. But i dont want to login with empty. Please seggest me.

Miduna says December 17, 2012

How we can Login with constant name as “admin” both username and password, in this example we can login with empty also

Micho says January 28, 2013

Package Name: com. example. LoginRequestExample without space!

Dennis says February 14, 2013

can u tel me the code for creating user id

Suha says April 26, 2013

great tutorial ..thank you 🙂

Peter says July 23, 2013

came @ the right time! Thanks! Although i am still not clean yet. Pls how do i correct d error “the method Onclick(View) from the type new View.OnclickListener(){} is never used locally”

Ahmed Ali says July 28, 2013

I wish to see real example of accessing remote database, and login using actual username and password!

Ronin says October 28, 2013

You have an error in LoginRequestExample activity source code, at line 25. I think it’s copy/paste issue..

fazlan says November 6, 2013

bro can you tell me how can i transfer this via bluetooth to another bluetooth device(well the device is arduino ) would be a great help

fazlan says November 6, 2013

Bro how can i send this user name and password via bluetooth for another bluetooth device(Other device arduino )

neal says November 21, 2013

nicely explained. thanks

saisushma says November 27, 2013

i am getting an error that main cannot be resolved or its not a field.login cannot be resolved or its a field.txtPassword cannot be resolved or its not a field….can some one help me out as soon as possible thank u

login example in android says August 23, 2014

[…] Login Request Example in Android | Android Programming Tutorials […]

Add Your Reply