If you not understand this lecture Edit text in android studioYou should also read my previous lectures.  Button and its click events in android and Open new Activity on button click. After reading these lecture you will also able to create text fields of your app.

Overview :

There are various types of edit text  fields in terms of their text inputs that helps the user to enter any input from the keyboard . A typical text field is a rectangle of any size When user enter a message and complete a text field(usually by pressing enter button) action occurs.It allows the developer to restrict the number of characters a user can type in a specific text field.

Introduction :

In this lecture we will describe Edit Text field along with its input types. Following the description and steps you will be able to implement Edit Text in application basically to enter user information, name, email etc.

Description of text field :

Edit text provides the user a facility  to enter some data. Information can be single line or multi line. In this lecture we will describe how to create a simple Edit Text field using Android Studio. First of all you will create a new project as stated earlier Creating New Project. Go to “res -> layout” and open file (with format .xml). Drag and Drop or add two Edit Text field by code and set their input types in tag android:inputType as “textEmailAddress” and “number”. After this step you can add hint message. Now you find out the value folder, expand this value folder and click on string.xml file. Add string  resource in string .XML file. For more detail about Edit text in android click on Text field.


Text field with different input type :

android:inputType is specifically used for different type. Below line is used to enter email address  e.g

Below line is used to enter Numbers and we are restricted to use the numeric keyboard in this case.

Certain keyboard behavior :

You can also use different keyboard behavior in android.According to the given condition the required behavior will be used in the given application. The piece of code in our XML file which is android:input  this is  specified for  different input types.

 Run the application text fields creation in android:


Output if you click in first Edit text field then keyboard appears that is suitable for email address


Output if you click in second Edit text field then keyboard appears that is suitable for mobile number


Auto-Complete TextView

we also describe how to create a Auto-Complete TextView in android studio. Auto-Complete TextView is an editable text view that shows completion suggestions automatically while the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box .for more detail about Auto-Complete TextView click on Auto Complete text view. First of all you will create a new project in android studio.Every project contain two file first is java class file and second is layout XML file So, your first step is open a layout . XML file and add auto-complete textview and set height and width. After complete this step you will add hint message and  also assign id to text view..So you will find out the value folder expand this value folder and click on string XML file and add string array of country name  in string .XML file.Now i open a string. XML file and paste that code

In this example we are going to create a simple UI that includes only (Auto complete testview) with Different attributes.And paste the following code into layout .XML file.

Now you may open the Graphical layout editor to preview the User Interface you created of Auto-Complete TextView in android.


Code that are write in java class file of Auto-Complete TextView in android

Run the Application

Now when you put( a) in Auto-Complete TextView  then show output in below pic


Now when you put (p) in Auto-Complete TextView show output in below pic



“Thank you”  for reading this lecture, Hope you got the idea about Android Edit Text.