How To Create A Simple Login Form In Android Studio Through Email And Password
Hello Guys,
Today i am going to show you how to create a simple login form in android studio where user have to enter their email and password, if email and password will be correct it will generate "Login Successful" message else it will generate "Enter valid details" if email and password will be incorrect. So Lets begin with the Java code which is used in android studio to make the application.

We have divided the whole coding into two parts in which first is for designing the application and second is for all links and condition means java coding.


activity_main.xml


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#E3E7FB"
    tools:context=".MainActivity">

    <ImageButton
        android:layout_width="fill_parent"
        android:layout_height="200dp"
        android:src="@drawable/rubex"
        android:scaleType="fitCenter"
        android:background="#E3E7FB"
        />
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="UNoWorld"
        android:textAlignment="center"
        android:textStyle="bold"
        android:textSize="50dp"
        android:textColor="#581845"
        />
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="----------------------------------"
        android:textAlignment="center"
        android:textSize="30dp"
        />
    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Enter Email ID"
        android:id="@+id/email"
        android:inputType="text"
        />
    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Enter Password"
        android:id="@+id/password"
        android:inputType="textPassword"
        />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="LogIn"
        android:id="@+id/btn"
        android:layout_marginVertical="5dp"
        android:layout_marginHorizontal="150dp"
        />

</LinearLayout>

Mainactivity.java

package com.myhindiadvice.www.loginpage;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        OnCLick();
    }

    EditText email,password;
    Button btn;

    public void OnCLick()
    {
        email=(EditText)findViewById(R.id.email);
        password=(EditText)findViewById(R.id.password);
        btn=(Button)findViewById(R.id.btn);

        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            if (email.getText().toString().equals("abc@gmail.com") && password.getText().toString().equals("654321"))
            {
                Toast.makeText(MainActivity.this, "LogIn Succesful", Toast.LENGTH_LONG).show();
            }else
            {
                Toast.makeText(MainActivity.this, "Enter Valid Detials", Toast.LENGTH_SHORT).show();
            }

            }
        });
    }
}

Here after the whole coding its time to check output of our application. so i have checked the output, everything is working correctly.

Hope this was helpful for you. if you are facing any problem or issue just comment below, we will reply you as soon as possible.
Thanks For Your Time.


How To Create Simple Interest Calculator App In Android Studio, Android Studio App Development Tutorials
Hello Guys,
Today i am going to make simple interest calculator App in Android Studio. While calculating simple interest we have to take some inputs from users that is Amount, Interest Rate and Time Period. i have tried to make the whole coding program in an easy way. Hope it will be helpful for You. i am sure this will be easy to understand for You.

I have shown here all codes of android studio while making Simple interest calculator app.
Let it see step by step.

activity_main.xml




<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="SImple Calculator"
        android:textAlignment="center"
        android:textSize="30dp"
        />
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="-------------------------------------------"
        android:textAlignment="center"
        android:textSize="30dp"
        />
    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Enter Amount"
        android:id="@+id/amt"
        android:textAlignment="center"
        android:inputType="number"
        />
    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Enter Interest Rate (In %)"
        android:id="@+id/interest"
        android:textAlignment="center"
        android:inputType="number"
        />
    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Enter Time (in Year)"
        android:id="@+id/tim"
        android:textAlignment="center"
        android:inputType="number"
        />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Calculate"
        android:id="@+id/btn"
        />

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/txt1"
    android:textSize="30dp"
    />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/txt2"
        android:textSize="20dp"
        />

</LinearLayout>


MainActivity.java


package com.myhindiadvice.www.simplecalculator;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        OnCLick();
    }

    EditText amt,interest,time;
    Button btn;
    TextView txt1,txt2;

    public  void OnCLick()
    {
        amt=(EditText)findViewById(R.id.amt);
        interest=(EditText)findViewById(R.id.interest);
        time=(EditText)findViewById(R.id.tim);
        btn=(Button)findViewById(R.id.btn);
        txt1=(TextView)findViewById(R.id.txt1);
        txt2=(TextView)findViewById(R.id.txt2);

        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int a=Integer.parseInt(amt.getText().toString());
                int b=Integer.parseInt(interest.getText().toString());
                int c=Integer.parseInt(time.getText().toString());
                int d;
                d=(a*b*c)/100;
                int e=a+d;

                txt1.setText("Total Interest Is :"+String.valueOf(d));
                txt2.setText("Total Amount is : "+String.valueOf(e));

            }
        });

    }
}




And after the whole coding lets see how our app looks like after entering the values and its interface.
This image is the preview of the application created through the Codes which you have seen before.


Hope this was helpful for you. if you are facing any problem just comment below or mail me personally.
All the best.
Thanks
How To Create Simple Calculator Application In Android Studio, Android Studio Application Development Tutorials
Hello Everyone, Today i am going to show you how to make a simple calculator in android studio. Basically in this calculator i will perform Five basic operation. First is SUM, SUBTRACTION, MULTIPLICATION, DIVISION AND RESET. I have tried to make this tutorial in very simple method. Hope this will be helpful for you to create Your Calculator in android studio.

First of all while building android app we first of all need the design User Interface of Application. For that the following codes are given which was used in activity_main.xml

activity_main.xml


     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-2709908168270813"
     data-ad-slot="1165711394">



<?xml version="1.0" encoding="utf-8"?>

<TableLayout 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=".MainActivity">

    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Enter First Number"
        android:id="@+id/txt1"
        android:inputType="number"
        />
    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Enter Second Number"
        android:id="@+id/txt2"
        android:inputType="number"
        />
    <TextView
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:id="@+id/res"
        />
    <TableRow>
        <Button
            android:layout_width="190dp"
            android:layout_height="180dp"
            android:id="@+id/plus"
            android:text="+"
            android:textSize="100dp"
            android:textColor="@color/colorAccent"
            />
        <Button
            android:layout_width="190dp"
            android:layout_height="180dp"
            android:id="@+id/minus"
            android:text="-"
            android:textSize="100dp"
            android:textColor="@color/colorAccent"
            />
    </TableRow>
    <TableRow>
        <Button
            android:layout_width="190dp"
            android:layout_height="180dp"
            android:id="@+id/multi"
            android:text="*"
            android:textSize="100dp"
            android:textColor="@color/colorAccent"
            />
        <Button
            android:layout_width="190dp"
            android:layout_height="180dp"
            android:id="@+id/divide"
            android:text="/"
            android:textSize="100dp"
            android:textColor="@color/colorAccent"
            />
    </TableRow>
    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/reset"
        android:text="RESET"
        android:textSize="20dp"
        android:textColor="@color/colorAccent"
        />

</TableLayout>




Here Is The Code Used in Mainactivity.java



package com.myhindiadvice.www.simplecalculator;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        OnCLick();
    }

    EditText txt1,txt2;
    TextView result;
    Button plus,minus,multiply,divide,reset;

    public void OnCLick()
    {
       txt1=(EditText)findViewById(R.id.txt1);
       txt2=(EditText)findViewById(R.id.txt2);
       result=(TextView)findViewById(R.id.res);
       plus=(Button)findViewById(R.id.plus);
        minus=(Button)findViewById(R.id.minus);
        multiply=(Button)findViewById(R.id.multi);
        divide=(Button)findViewById(R.id.divide);
        reset=(Button)findViewById(R.id.reset);

        plus.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int a=Integer.parseInt(txt1.getText().toString());
                int b=Integer.parseInt(txt2.getText().toString());
                int c=a+b;
                result.setText(String.valueOf(c));
            }
        });

        minus.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int a=Integer.parseInt(txt1.getText().toString());
                int b=Integer.parseInt(txt2.getText().toString());
                int c=a-b;
                result.setText(String.valueOf(c));
            }
        });

        multiply.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int a=Integer.parseInt(txt1.getText().toString());
                int b=Integer.parseInt(txt2.getText().toString());
                int c=a*b;
                result.setText(String.valueOf(c));
            }
        });

        divide.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int a=Integer.parseInt(txt1.getText().toString());
                int b=Integer.parseInt(txt2.getText().toString());
                int c=a/b;
                result.setText(String.valueOf(c));
            }
        });
        reset.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                txt1.setText("");
                txt2.setText("");
                result.setText("");
            }
        });

    }
}


This is how our application looked like after designing its user interface. it is not a professional look, you can edit it as per your requirement and as you want. this is just only for example so that i have made it very simple so that everyone can understand it easily.

And after entering the values in EditText, i have performed SUM or plus operation and it showed the final result in Textview.


Hope It was helpful for you to understand how to make Simple Calculator In Android Studio. if you are facing any problem just comment below or mail me personally.
ThankYou