Android Studio – Android Login Screen Example




In this tutorial we will learn How to create a simple Login Screen project Using Android Studio.

So lets create a project.

Step 1  – Create new Android project.

Provide Activity name as Login as shown below

Android Login Screen Example Login Activity
Android Login Screen Example Login Activity

 

Step 2 – Add components in the main activity as shown in the picture below.

Android Login Screen Example Design
Android Login Screen Example Design

SimpleLoginApp\app\src\main\res\layout\activity_login.xml

 

Now Chenge the AndroidManifest.xml file as shown in the code below:

\SimpleLoginApp\app\src\main\AndroidManifest.xml

Now go to values\strings.xml and change it as shown n the code

\SimpleLoginApp\app\src\main\res\values\strings.xml

Step 3 Add the new activity . Right Click Project -> New -> Activity -> Blank Activity

Give the name to your activity  User

create blank activity
create blank activity

write the following code

SimpleLoginApp\app\src\main\res\layout\activity_user.xml

com/example/programmingknowledge/simpleloginapp/Login.java

com/example/programmingknowledge/simpleloginapp/User.java

 

Now Run your app

Output:

Android Login Screen Example Output wrong user and password
Android Login Screen Example Output wrong user and password

 

Android Login Screen Example Output correct user and password

Android Login Screen Example Output correct user and password

Android Login Screen Example Output correct user and password Next activity
Android Login Screen Example Output correct user and password Next activity

 
Foer more Details watch the videos



Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


  • Ramakanta Chandra

    Thank you sir, your videos are very helpful. I like ur way of solving any problem i.e simple and straightforward. Currently i am trying make an android app. The problem i am facing is it doesn’t work for all screen size. i am using relative layout and sometime for button and textview size i am using integer values (i.e not using wrap content or fill parent everytime). is there any solution is there?

  • Sir ,
    I face a problem When I generate Signed Apk
    “Generate Signed APK
    Errors while building APK. You can find the errors in the ‘Messages’ view.”

  • Nisha Shah

    Username and passwords are given in the code itself. I want the app to login using data from mySQL on hosted database.