Facebook Twitter Instagram
    DeepCrazyWorld
    Facebook Twitter Instagram Pinterest YouTube
    • FLUTTER
      • FLUTTER APP
        • QRCode
        • Quiz App
        • Chat GPT
        • PDF App
        • News App
        • Fitness App
        • Weather App
        • BMI Calculator
        • GAME APP
        • Ecommerce App
        • wallpaper App
        • Finance app
        • Chat App
        • Wallet App
        • Taxi App
        • Quran app
        • Music player app
      • FLUTTER UI
        • Splash Screen
        • Onboarding Screen
        • Login Screen
        • Card Design
        • Drawer
    • PROJECT
      • Android Projects
      • College Projects
      • FLUTTER APP
      • Project Ideas
      • PHP Projects
      • Python Projects
    • SOURCE CODE
    • ANDROID
      • ANDROID APP
      • GAME APP
      • ANDROID STUDIO
    • MCQ
      • AKTU MCQ
        • RPA MCQ
        • COA MCQ
        • HPC MCQ
        • SPM MCQ
        • Renewable Energy All MCQ
        • Data Compression MCQ
        • Data Structure MCQ
        • Digital Image Processing MCQ
        • Software Engineering MCQ
        • Machine Learning MCQ
        • Artificial Intelligence MCQ
      • D PHARMA MCQ
        • Pharmaceutics – I MCQ
        • Pharmacognosy MCQ
        • Pharmaceutical Chemistry MCQ
        • Biochemistry and Clinical Pathology MCQ
        • Human Anatomy and Physiology MCQ
        • Heath Education and Community Pharmacy MCQ
    • INTERVIEW QUESTIONS
      • Flutter Interview Questions
      • INTERVIEW QUESTIONS
      • Python Interview Questions
      • Coding ninjas solution
    • MORE
      • WORDPRESS
        • SEO
        • TOP 10 WORDPRESS THEME
      • PRODUCTIVITY
      • Program
      • QUOTES
    DeepCrazyWorld
    Home»ANDROID APP»Create Simple Android Login Application with android studio
    ANDROID APP

    Create Simple Android Login Application with android studio

    DeepikaBy DeepikaJanuary 12, 2022Updated:January 19, 2022No Comments4 Mins Read

    Simple Login Application Using Android 2022 . Android is basically a piece of software that allows your hardware to function. The android is an open-source operating system it’s free and user friendly to mobile developers. Android is available to any device such as TV, phones, watches, etc.

    So now let’s do the coding.

    Getting Started:
    First you will have to download & install the Android Development IDE (Android Studio or Eclipse). Android Studio is an open-source development feel free to develop your things.
    Here’s the link for the Android Studio https://developer.android.com/studio/index.html.

    <img decoding=

    Table of Contents

    Toggle
    • Layout Design
    • activity_login.xml
    • activity_user.xml
    • Android Manifest File
    • The Main Function
    • Login.java
    • User.java
    • Try to run and see if it works:
    • FOR YOUR OWN SAFETY, PLEASE:
    • ANDROID APP FREE SOURCE CODE
      • Cheers!
    • READ MORE…

    Layout Design


    We will now create the design for the application, first, locate the layout folder and select the activity_login.xml. Then copy and paste the code below.

    activity_login.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.razormist.simpleloginapplication.Login">
     
     
        <TextView
            android:id="@+id/tv_login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="11dp"
            android:layout_marginStart="11dp"
            android:layout_marginTop="13dp"
            android:text="Login"
            android:fontFamily="sans-serif-condensed"
            android:textSize="30sp"/>
     
     
     
        <TextView
            android:id="@+id/tv_username"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/tv_login"
            android:layout_alignStart="@+id/tv_login"
            android:layout_below="@+id/tv_login"
            android:layout_marginTop="80dp"
            android:fontFamily="monospace"
            android:text="Username"
            android:textSize="25sp" />
     
        <EditText
            android:id="@+id/et_username"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/tv_username"
            android:ems="17"
            android:layout_alignLeft="@+id/tv_username" />
     
     
     
        <TextView
            android:id="@+id/tv_password"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/et_username"
            android:layout_alignStart="@+id/et_username"
            android:layout_below="@+id/et_username"
            android:layout_marginTop="33dp"
            android:fontFamily="monospace"
            android:text="Password"
            android:textSize="25sp" />
     
        <EditText
            android:id="@+id/et_password"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:ems="17"
            android:layout_below="@+id/tv_password"
            android:layout_alignLeft="@+id/tv_password" />
     
     
        <Button
            android:id="@+id/btn_login"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_below="@id/et_password"
            android:layout_centerInParent="true"
            android:ems="12"
            android:layout_marginTop="30dp"
            android:text="Login"/>
     
     
    </RelativeLayout>
    
     
    

    Next is create another layout by right-clicking the layout folder namely activity_user.xml. Then write these blocks code to the layout script.

    activity_user.xml

    
    
    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.razormist.simpleloginapplication.User">
     
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Welcome"
            android:textSize="40sp"
            android:layout_marginTop="177dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true" />
     
        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="30sp"
            android:layout_marginTop="30dp"
            android:layout_centerInParent="true"
            android:layout_below="@+id/textView1"
            android:text="Administrator"/>
     
    </RelativeLayout>
    
    


    Android Manifest File

    
    
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.razormist.simpleloginapplication">
     
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <activity android:name=".Login"
                android:configChanges="orientation"
                android:screenOrientation="portrait">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
     
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity android:name=".User"
                android:configChanges="orientation"
                android:screenOrientation="portrait">
                <intent-filter>
                    <action android:name="com.razormist.simpleloginapplication.User" />
     
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>
        </application>
    </manifest>
    
    


    The Android Manifest file provides essential information about your app to the Android system in which the system must required before running the code.

    The Main Function


    Login.java

    
    
    package com.razormist.simpleloginapplication;
     
    import android.content.Intent;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.Toast;
     
    public class Login extends AppCompatActivity {
     
        EditText et_username, et_password;
        Button btn_login;
     
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_login);
     
            Login();
        }
     
        void Login(){
            et_username = (EditText)findViewById(R.id.et_username);
            et_password = (EditText)findViewById(R.id.et_password);
            btn_login = (Button)findViewById(R.id.btn_login);
     
            btn_login.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if(et_username.getText().toString().equals("admin") && et_password.getText().toString().equals("admin")){
                        Toast.makeText(Login.this, "Username and Password is correct", Toast.LENGTH_SHORT).show();
                        Intent intent = new Intent(Login.this,User.Class);
                        startActivity(intent);
                    }else{
                        Toast.makeText(Login.this, "Username or Password is incorrect", Toast.LENGTH_SHORT).show();
                    }
                }
            });
        }
    }
    
    


    This code contains the main function of the application. This code will login the user when the username and password are entered correctly. To create the function just write the code inside the Login class


    User.java

    
    
    package com.razormist.simpleloginapplication;
     
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
     
    public class User extends AppCompatActivity {
     
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_user);
        }
    }
    
    


    This code will render a new layout after the user successfully login. This is where the user is redirect after entering the correction information. Just write these block of codes inside the User class.


    Try to run and see if it works:


    username: admin
    password: admin

    There you have it we successfully created a Simple Login Application using Android. I hope that this tutorial gives you some ideas about android programming. For more updates and tutorials just kindly visit this site.

    Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

    Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

    FOR YOUR OWN SAFETY, PLEASE:

    1. Re-scan downloaded files using your personal virus checker before using it.
    2. NEVER, EVER run compiled files (.exe’s, .ocx’s, .dll’s etc.)–only run source code.

    Enjoy Coding.

    ANDROID APP FREE SOURCE CODE

    • Wallpaper Android App- CLICK HERE
    • All IN ONE Status Saver App – CLICK HERE
    • Photo Video Maker Android App – CLICK HERE
    • Video Downloader Android App – CLICK HERE
    • College Student Portal System App – CLICK HERE
    • Call Recorder Android App – CLICK HERE
    • PDF App with firebase – CLICK HERE
    • BarChart Graph App – CLICK HERE
    • PDF Reader App with firebase – CLICK HERE
    • ShareIt Clone App – CLICK HERE
    • Material Design SignUp Form – CLICK HERE
    • Ludo Game App – CLICK HERE
    • Text on Photo Android App – CLICK HERE
    • 3D Text Maker App – CLICK HERE

    ShareTweetShare


    Cheers!

    READ MORE…

    Share. Facebook Twitter LinkedIn WhatsApp Telegram Pinterest Reddit Email
    Previous ArticleTop 20+ Best Android app Project with Android Studio 2023
    Next Article Top 30+ Coding Interview Questions with solution 2023 (updated)

    Related Posts

    Flutter Quiz Game App for android and iOS source code

    Quiz App 3 Mins Read

    Swipe Book – E-book pdf Mobile App For Android and iOS Using Flutter

    PDF App 3 Mins Read

    Workout Fitness App built using Flutter for android and iOS

    Fitness App 4 Mins Read

    Beautiful Login Page UI made in flutter source code

    Login Screen 3 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • Implementing a Dynamic FAQ Screen UI in Flutter Using ExpansionTile March 29, 2025
    • Creating an Instruction UI Screen in Flutter Application March 29, 2025
    • Animated Backgrounds in Flutter: A Complete Guide March 15, 2025
    • How to make Diary App using flutter stepwise using getx August 31, 2024
    • How to Create Music Player UI screen with fully functional in flutter August 30, 2024
    • How to make ListView Builder Ui in flutter with Source Code August 29, 2024
    • Create a TabBar View in flutter with fully functional stepwise August 28, 2024
    • How to create TabBar view in flutter with source code step wise August 27, 2024
    • How to make Heart rate measure app with Flutter stepwise August 26, 2024
    • How to make ChatGpt App in flutter with source code Stepwise August 25, 2024
    Facebook Twitter Instagram Pinterest YouTube
    • About
    • Contact
    • Disclaimer
    • Privacy Policy
    Copyright by DeepCrazyWorld © 2025

    Type above and press Enter to search. Press Esc to cancel.