How to Create an Android Application on Student’s Result using android studio ?

Introduction :

Hello everyone, as we all know in the present era we all are surrounded by a bulk of applications and we get addicted to such applications. So here we are going to construct an application for the teachers to find the student’s result easily.We will use android studio 3.0 to construct the required application.

Description :
  • Design Of Application: Before moving ahead it’s very important to think about designing and to choose the required parameters.So, we will take 6 EditText since we wanted to find the result of three subjects and 3 for maximum marks and 2 TextView, one for the percentage and the other for the division of the student receives and one button.To choose such keywords on your application you can open the mainXML design portion, drag and drop the required keywords.
  • Color: Since we are having our primary colors as Red, Green, Blue.Here in android designing to choose the red color we will take #FF0000(Red, Green, Blue).
  • MainActivity : We put the required program in the mainActivity, we take findviewbyid to take to assign a particular id to the keywords used in the program.We take GetDiv function for the command given to the system.
  • Code in mainActivity :
package com.example.sakshi.studentresult;

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

public class MainActivity extends AppCompatActivity {
    EditText t1,t2,t3,t4,t5,t6;
    TextView tv,tv1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        t1= findViewById(R.id.t1);
        t2= findViewById(R.id.t2);
        t3= findViewById(R.id.t3);
        t4= findViewById(R.id.t4);
        t5= findViewById(R.id.t5);
        t6= findViewById(R.id.t6);
        tv= findViewById(R.id.tv);
        tv1=findViewById(R.id.tv1);
    }
    public void Getdiv(View v){
        try {
            Integer a = Integer.parseInt("" + t1.getText());
            Integer m1 = Integer.parseInt("" + t2.getText());
            Integer b = Integer.parseInt("" + t3.getText());
            Integer m2 = Integer.parseInt("" + t4.getText());
            Integer c = Integer.parseInt("" + t5.getText());
            Integer m3 = Integer.parseInt("" + t6.getText());
            double avg = (a + b + c)*1.0 / (m1 + m2 + m3)*1.0;
            double r=avg*100.0;
            {
                if (r<30)
                    tv1.setText("Fail! Padhle Munna");
                else
                 if (r>=30 && r <=70)
                    tv1.setText("Work Hard! Second Division");
                else
                    tv1.setText("Congratulations! Pappu pass ho gya");
            }
            tv.setText("" + r);
        }
        catch (Exception ex){
            System.out.println(ex);
            tv.setText(ex.getMessage());
        }

    }
}

  • Code In mainXML :
<?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"
    android:background="#ff00ff"
    tools:context="com.example.sakshi.studentresult.MainActivity">


    <EditText
        android:id="@+id/t1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginEnd="264dp"
        android:layout_marginRight="264dp"
        android:layout_marginTop="20dp"
        android:ems="10"
        android:hint="Physics "
        android:inputType="numberSigned"
        android:textColor="#000000" />

    <EditText
        android:id="@+id/t2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/t1"
        android:layout_alignBottom="@+id/t1"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginLeft="247dp"
        android:layout_marginStart="247dp"
        android:ems="10"
        android:text="100"
        android:textColor="#000000"
        android:inputType="numberSigned" />

    <EditText
        android:id="@+id/t3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignEnd="@+id/t1"
        android:layout_alignRight="@+id/t1"
        android:layout_below="@+id/t1"
        android:layout_marginTop="15dp"
        android:ems="10"
        android:hint="Maths"
        android:inputType="numberSigned"
        android:textColor="#000000" />

    <EditText
        android:id="@+id/t4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/t2"
        android:layout_alignStart="@+id/t2"
        android:layout_alignTop="@+id/t3"
        android:ems="10"
        android:text="100"
        android:textColor="#000000"
        android:inputType="numberSigned" />

    <EditText
        android:id="@+id/t5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignEnd="@+id/t3"
        android:layout_alignRight="@+id/t3"
        android:layout_below="@+id/t3"
        android:layout_marginTop="15dp"
        android:ems="10"
        android:hint="Chemistry"
        android:inputType="numberSigned"
        android:textColor="#000000" />

    <EditText
        android:id="@+id/t6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/t4"
        android:layout_alignStart="@+id/t4"
        android:layout_alignTop="@+id/t5"
        android:ems="10"
        android:text="100"
        android:textColor="#000000"
        android:inputType="numberSigned" />

    <TextView
        android:id="@+id/tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button"
        android:layout_alignStart="@+id/button"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:background="#fff000"
        android:textSize="24sp" />

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="71dp"
        android:background="#00ffff"
        android:onClick="Getdiv"
        android:text="Get Division" />

    <TextView
        android:id="@+id/tv1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignEnd="@+id/button"
        android:layout_alignRight="@+id/button"
        android:layout_below="@+id/tv"
        android:layout_marginTop="20dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:background="#fff000"
        android:textSize="24sp" />


</RelativeLayout>

Layout Design :
OUTPUT :

Thank You!

Leave a Reply