0% found this document useful (0 votes)
50 views19 pages

Name: Vimal Singh Rawat Course: Bca (5B) : Mainactivity - Java

This document describes an android application project to swap the contents of two EditText widgets. The project was created in Android Studio and includes a MainActivity class with a method to swap the strings between two EditText fields when a button is clicked. The UI layout contains two EditText fields and a button, and is designed to familiarize the student with different android widgets.

Uploaded by

Vimal Rawat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views19 pages

Name: Vimal Singh Rawat Course: Bca (5B) : Mainactivity - Java

This document describes an android application project to swap the contents of two EditText widgets. The project was created in Android Studio and includes a MainActivity class with a method to swap the strings between two EditText fields when a button is clicked. The UI layout contains two EditText fields and a button, and is designed to familiarize the student with different android widgets.

Uploaded by

Vimal Rawat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 19

NAME: VIMAL SINGH RAWAT

COURSE: BCA(5B) 

AIM :
Design and develop an android app for greeting user by their name.
Objectives
To familiarise simple android application
Apparatus/Tools/Equipments/Components
Android studio
Procedure
1. In Android Studio, create a new project.
2. Give the name to the Application and choose the project location and minimum android sdk
version to marshmallow.
3. Select empty activity for development of android application.
4. Design UI for the application
5. Implement the java code for the application.
6. Open AVD manager and Run virtual device.
7. Run project on virtual device.
MainActivity.java
package com.example.pc77.helloworldapp;

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

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void show(View v){
EditText et=findViewById(R.id.editText3);
String name;
name=et.getText().toString();
TextView tv=findViewById(R.id.textView);
name="Hello "+name;
tv.setText(name);
}
}
Layout_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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"
tools:layout_editor_absoluteY="25dp">

<EditText
android:id="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="@string/enter_your_name"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.085" />

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="49dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:onClick="show"
android:text="@string/click"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText3"
app:layout_constraintVertical_bias="0.129" />

<TextView
android:id="@+id/textView"
android:layout_width="263dp"
android:layout_height="69dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:gravity="center_vertical"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.505"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button"
app:layout_constraintVertical_bias="0.334" />
</android.support.constraint.ConstraintLayout>
NAME: VIMAL SINGH RAWAT
COURSE: BCA(5B) 
AIM :
Create an android application to check eligibility for casting vote.
Objectives
To use conditional statements in Java file.
Apparatus/Tools/Equipments/Components
Android studio
Procedure
1. In Android Studio, create a new project.
2. Give the name to the Application and choose the project location and minimum android sdk
version to marshmallow.
3. Select empty activity for development of android application.
4. Design UI for the application
5. Implement the java code for the application.
6. Open AVD manager and Run virtual device.
7. Run project on virtual device.
MainActivity.java
package com.example.pc77.helloworldapp;

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

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void check(View v){
EditText et=findViewById(R.id.editText4);
TextView tv=findViewById(R.id.textView2);
int age;
age=Integer.parseInt(et.getText().toString());
if(age>=18)
tv.setText("You are eligible to vote");
else
tv.setText("You are not eligible to vote");
}
}
Acivity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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"
tools:layout_editor_absoluteY="25dp">

<EditText
android:id="@+id/editText4"
android:layout_width="217dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="@string/enter_your_age"
android:inputType="number"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.078" />

<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:onClick="check"
android:text="Check"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText4"
app:layout_constraintVertical_bias="0.179"
tools:text="Check" />

<TextView
android:id="@+id/textView2"
android:layout_width="242dp"
android:layout_height="73dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:gravity="center_vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button3"
app:layout_constraintVertical_bias="0.408" />
</android.support.constraint.ConstraintLayout>

.
NAME: VIMAL SINGH RAWAT
COURSE: BCA(5B) 
AIM :
Design and develop an android application to swap the contents of two EditText.
Objectives
To get familiar with different android widgets.
Apparatus/Tools/Equipments/Components
Android studio
Procedure
1. In Android Studio, create a new project.
2. Give the name to the Application and choose the project location and minimum android sdk
version to marshmallow.
3. Select empty activity for development of android application.
4. Design UI for the application
5. Implement the java code for the application.
6. Open AVD manager and Run virtual device.
7. Run project on virtual device.
MainActivity.java
package com.example.pc77.helloworldapp;

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

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void swap(View v){
EditText et,et2;
et=findViewById(R.id.editText5);
et2=findViewById(R.id.editText6);
String first,second;
first=et.getText().toString();
second=et2.getText().toString();
et.setText(second);
et2.setText(first);
}
}
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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"
tools:layout_editor_absoluteY="25dp">

<EditText
android:id="@+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="Enter first string"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.083" />

<EditText
android:id="@+id/editText6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="Enter second string"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText5"
app:layout_constraintVertical_bias="0.17" />

<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:onClick="swap"
android:text="SWAP"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText6"
app:layout_constraintVertical_bias="0.252" />
</android.support.constraint.ConstraintLayout>
NAME: VIMAL SINGH RAWAT
COURSE: BCA(5B) 
AIM :
Develop an android application to convert CGPA to percentage and vice versa.
Objectives
To get familiar with buttons calling different methods.
Apparatus/Tools/Equipments/Components
Android studio
Procedure
1. In Android Studio, create a new project.
2. Give the name to the Application and choose the project location and minimum android sdk
version to marshmallow.
3. Select empty activity for development of android application.
4. Design UI for the application
5. Implement the java code for the application.
6. Open AVD manager and Run virtual device.
7. Run project on virtual device.
MainActivity.java
package com.example.pc77.helloworldapp;

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

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void convert(View v){
EditText et=findViewById(R.id.editText);
float num,res,mul=9.5f;
TextView tv=findViewById(R.id.textView);
num=Float.parseFloat(et.getText().toString());
if(num<=10) {
res = num*mul;
tv.setText(String.valueOf(res+"%"));
}
else
{
res = num/mul;
tv.setText(String.valueOf(res));
}
}
}
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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"
tools:layout_editor_absoluteY="25dp">

<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="@string/enter_cgpa_percentage"
android:inputType="numberDecimal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.094" />

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:onClick="convert"
android:text="@string/convert"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText"
app:layout_constraintVertical_bias="0.146" />

<TextView
android:id="@+id/textView"
android:layout_width="256dp"
android:layout_height="65dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:gravity="center_horizontal"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button"
app:layout_constraintVertical_bias="0.36" />
</android.support.constraint.ConstraintLayout>
NAME: VIMAL SINGH RAWAT
COURSE: BCA(5B) 
AIM :
Create an android application to convert dollar into rupees and vice versa.
Objectives
To get familiar with buttons calling different methods.
Apparatus/Tools/Equipments/Components
Android studio
Procedure
1. In Android Studio, create a new project.
2. Give the name to the Application and choose the project location and minimum android sdk
version to marshmallow.
3. Select empty activity for development of android application.
4. Design UI for the application
5. Implement the java code for the application.
6. Open AVD manager and Run virtual device.
7. Run project on virtual device.
MainActivity.java
package com.example.pc77.helloworldapp;

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

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void convert(View v) {
float usd,inr;
if(v.getId()==R.id.button2){
EditText et,et2;
et=findViewById(R.id.editText2);
et2=findViewById(R.id.editText3);
usd=Float.parseFloat(et.getText().toString());
inr=usd*71.613f;
et2.setText(String.valueOf(inr));
}
else{
EditText et,et2;
et2=findViewById(R.id.editText5);
et=findViewById(R.id.editText4);
inr=Float.parseFloat(et.getText().toString());
usd=inr*0.01396f;
et2.setText(String.valueOf(usd));
}
}
}
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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"
tools:layout_editor_absoluteY="25dp">

<EditText
android:id="@+id/editText2"
android:layout_width="94dp"
android:layout_height="44dp"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="USD"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.181" />

<EditText
android:id="@+id/editText3"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:ems="10"
android:hint="INR"
android:inputType="textPersonName"
app:layout_constraintBaseline_toBaselineOf="@+id/button2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.617"
app:layout_constraintStart_toEndOf="@+id/button2" />

<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="44dp"
android:layout_marginStart="44dp"
android:onClick="convert"
android:text="To"
app:layout_constraintBaseline_toBaselineOf="@+id/editText2"
app:layout_constraintStart_toEndOf="@+id/editText2" />

<TextView
android:id="@+id/textView2"
android:layout_width="140dp"
android:layout_height="36dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:gravity="center_vertical"
android:text="USD to INR"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="@+id/editText2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.566"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.468" />

<TextView
android:id="@+id/textView3"
android:layout_width="145dp"
android:layout_height="42dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="INR to USD"
android:gravity="fill_horizontal"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.57"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.446" />

<EditText
android:id="@+id/editText4"
android:layout_width="98dp"
android:layout_height="44dp"
android:layout_marginBottom="16dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="52dp"
android:ems="10"
android:hint="INR"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3"
app:layout_constraintVertical_bias="0.0" />

<Button
android:id="@+id/button3"
android:layout_width="87dp"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginStart="32dp"
android:onClick="convert"
android:text="To"
app:layout_constraintBaseline_toBaselineOf="@+id/editText4"
app:layout_constraintStart_toEndOf="@+id/editText4" />

<EditText
android:id="@+id/editText5"
android:layout_width="80dp"
android:layout_height="48dp"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:ems="10"
android:hint="USD"
android:inputType="textPersonName"
app:layout_constraintBaseline_toBaselineOf="@+id/button3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/button3" />
</android.support.constraint.ConstraintLayout>

\
NAME: VIMAL SINGH RAWAT
COURSE: BCA(5B) 
AIM :
Design and develop an android application BMI calculator.
Objectives
To get familiar with buttons calling different methods.
Apparatus/Tools/Equipments/Components
Android studio
Procedure
1. In Android Studio, create a new project.
2. Give the name to the Application and choose the project location and minimum android sdk
version to marshmallow.
3. Select empty activity for development of android application.
4. Design UI for the application
5. Implement the java code for the application.
6. Open AVD manager and Run virtual device.
7. Run project on virtual device.
MainActivity.java
package com.example.pc77.bmicalculator;

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

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
void calculate(View v){
EditText et,et1,et2;
et=findViewById(R.id.editText2);
et1=findViewById(R.id.editText3);
et2=findViewById(R.id.editText4);
float weight,height,bmi;
weight=Float.parseFloat(et.getText().toString());
height=Float.parseFloat(et1.getText().toString());
bmi=weight/(height*height);
et2.setText(String.valueOf(bmi));
}
}
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="Enter weight(in kgs)"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.152" />

<EditText
android:id="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="Enter height(in metres)"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText2"
app:layout_constraintVertical_bias="0.15" />

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:onClick="calculate"
android:text="Calculate"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText3"
app:layout_constraintVertical_bias="0.164" />
<EditText
android:id="@+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="BMI"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.503"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button"
app:layout_constraintVertical_bias="0.205" />

</android.support.constraint.ConstraintLayout>

You might also like