0% found this document useful (0 votes)
1K views8 pages

Practical No 7

Uploaded by

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

Practical No 7

Uploaded by

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

Mobile Application Development (22617) Practical No.

Practical No. 7: Develop a program to implement Text View and Edit Text

I. Practical Significance
In this practical, UI controls in android like Text view and edit view are studied.
Wherein the UI controls can be developed, used and placed on the screen using
different layout managers as per the problem statement requirements.

II. Relevant Program Outcomes (POs)


PO 1. Basic knowledge
PO 2. Discipline knowledge
PO 3. Experiments and practice
PO 4. Engineering tools
PO 7. Ethics
PO 10. Life-long learning

III. Competency and Practical Skills


“Create simple Android applications.”
This practical is expected to develop the following skills
1. Able to develop UI controls like Text View and Edit Text.
2. Able to test UI controls like Text View and Edit Text by checking its placing on the
display screen.
3. Able to build UI controls like Text View and Edit Text, once testing is done and there
are no errors.

IV. Relevant Course Outcome(s)


1. Develop rich user Interfaces by using layouts and controls. 2. Use User Interface
components for android application development.

V. Practical Outcome (PrOs)


Develop a program to implement Text View and Edit Text.

VI. Relevant Affective Domain Related Outcome(s) 1. Work


collaboratively in team
2. Follow ethical Practices.

VII. Minimum Theoretical Background

1. Text View:
In Android, Text View displays text to the user and optionally allows them to edit it
programmatically. Text View is a complete text editor, however basic class is configured to
not allow editing but we can edit it. View is the parent class of Text View Being a subclass of
view the text view component can be used in your app’s.
GUI inside a View Group, or as the content view of an activity. We can create a Text View
instance by declaring it inside a layout (XML file) or by instantiating it programmatically(Java
Class).

Maharashtra State Board of Technical Education 1


Mobile Application Development (22617) Practical No. 7

2. Edit Text:
In Android, Edit Text is a standard entry widget in android apps. It is an overlay over Text
View that configures itself to be editable. Edit Text is a subclass of Text View with text
editing operations. Often use Edit Text in our applications in order to provide an input or
text field, especially in forms. The simplest example of Edit Text is Login or Sign-in form.
Text Fields in Android Studio are basically Edit Text.
Note: An Edit Text is simply a thin extension of a Text View. An Edit Text inherits all the
properties of a Text View.

VIII. Resources required (Additional)

Sr. Instrument /Object Specification Quantity Remarks


No.
Android enabled 2 GB RAM 1 Data cable is
smartphone / Android mandatory for
1
version supporting emulators
emulator

IX. Practical related Questions


Note: Below given are few sample questions for reference. Teachers must design more
such questions to ensure the achievement of identified CO.
1. Which of these is not defined as a process state?
a. Non-visible 

Maharashtra State Board of Technical Education 2


Mobile Application Development (22617) Practical No. 7

b. Visible
c. Foreground
d. Background

2. What is the name of the folder that contains the R.java file?
a. src
b. res
c. bin
d. gen 

X. Exercise
Note: Faculty must ensure that every group of students use different input value.
(Use blank space for answers or attach more pages if needed)
1. Write a program to accept username and password from the end user using Text View
and Edit Text.
2. Write a program to accept and display personal information of the student.

(Space for answers)

1.
//MainActivity.java
package com.jamiapolytechnic.experiment71;

import androidx.appcompat.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 {


Button btnLogin;
EditText name, password;
TextView result;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
name=(EditText)findViewById(R.id.txtName);
password = (EditText)findViewById(R.id.txtPwd);
result = (TextView) findViewById(R.id.txtResult);
btnLogin = (Button) findViewById(R.id.btnLogin);

btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

Maharashtra State Board of Technical Education 3


Mobile Application Development (22617) Practical No. 7

if (name.getText().toString().isEmpty() ||
password.getText().toString().isEmpty()) {
result.setText("Please Fill All the Details");
}
}
});
}
}

//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
//activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="40dp"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email or Phone"
android:textSize="15sp"/>
<EditText
android:id="@+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="25"
android:hint="Enter Email ID or Phone No." />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password"
android:textSize="15sp"/>
<EditText
android:id="@+id/txtPwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="25"
android:hint="Enter Password" />
<Button
android:id="@+id/btnLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:textSize="15sp"
android:textStyle="normal|bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"

Maharashtra State Board of Technical Education 4


Mobile Application Development (22617) Practical No. 7

android:text="Forgot password ?" />


<TextView
android:id="@+id/txtResult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:text=" " />
</LinearLayout>

2.
//MainActivity.java
package com.jamiapolytechnic.experiment72;

import androidx.appcompat.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 {


Button btnSubmit;
EditText name, password, email, dob, phoneno;
TextView result;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
name=(EditText)findViewById(R.id.txtName);
password = (EditText)findViewById(R.id.txtPwd);
email = (EditText)findViewById(R.id.txtEmail);
dob = (EditText)findViewById(R.id.txtDate);
phoneno= (EditText)findViewById(R.id.txtPhone);
btnSubmit = (Button)findViewById(R.id.btnSend);
result = (TextView)findViewById(R.id.resultView);
btnSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (name.getText().toString().isEmpty()
|| password.getText().toString().isEmpty()
|| email.getText().toString().isEmpty()
|| dob.getText().toString().isEmpty()
|| phoneno.getText().toString().isEmpty()) {
result.setText("Please Fill All the Details");
}else {
result.setText("Name - " + name.getText().toString()
+ " \n" + "Password - " + password.getText().toString()
+ " \n" + "E-Mail - " + email.getText().toString()
+ " \n" + "DOB - " + dob.getText().toString()

Maharashtra State Board of Technical Education 5


Mobile Application Development (22617) Practical No. 7

+ " \n" + "Contact - " + phoneno.getText().toString());


}

}
});
}
}

//========================================================================
//activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="40dp"
android:orientation="vertical" android:id="@+id/linearlayout" >
<EditText
android:id="@+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:ems="10"
android:hint="Name"
android:inputType="text"
android:selectAllOnFocus="true" />
<EditText
android:id="@+id/txtPwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Password 0 to 9"
android:inputType="numberPassword" />
<EditText
android:id="@+id/txtEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Email"
android:inputType="textEmailAddress" />
<EditText
android:id="@+id/txtDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText3"
android:ems="10"
android:hint="Date of Birth"
android:inputType="date" />
<EditText
android:id="@+id/txtPhone"
android:layout_width="wrap_content"

Maharashtra State Board of Technical Education 6


Mobile Application Development (22617) Practical No. 7

android:layout_height="wrap_content"
android:ems="10"
android:hint="Phone Number"
android:inputType="phone"
android:textColorHint="#FE8DAB"/>
<Button
android:id="@+id/btnSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="submit"
android:textSize="16sp"
android:textStyle="normal|bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/resultView"
android:layout_marginTop="25dp"
android:textSize="15dp"/>
</LinearLayout>

Maharashtra State Board of Technical Education 7


Mobile Application Development (22617) Practical No. 7

XI. References / Suggestions for further Reading


1. https://www.tutorialspoint.com/android
2. https://stuff.mit.edu
3. https://www.tutorialspoint.com/android/android_advanced_tutorial.pdf
4. https://developer.android.com

XII. Assessment Scheme

Performance indicators Weightage

Process related (10 Marks) 30%

1. Logic Formation 10%


2. Debugging ability 15%
3. Follow ethical practices 5%
Product related (15 Marks) 70%

4. Interactive GUI 20%


5. Answer to Practical related questions 20%
6. Expected Output 20%
7. Timely Submission 10%
Total (25 Marks) 100%

List of student Team Members

1
2
3
4

Dated signature of
Marks Obtained
Teacher
Process Product Total
Related(10) Related(15) (25)

Maharashtra State Board of Technical Education 8

You might also like