Android EditText Example

An EditText is an user interface element for entering and modifying text. Now let’s create an app which displays the text written in EditText, into a TextView. Step 1: Create a new project with name edittextexample and package name com.myapp.edittextexample. Select File -> New -> New Project. Fill the forms and click “Finish” button. Step 2: Open res … Read more

Android Toast Example

A toast displays a simple message in a small popup, which automatically disappear after a timeout. The code to display a Toast is: Position of Toast: A standard toast notification appears near the bottom of the screen, centered horizontally. You can change this position with the setGravity(int, int, int) method. This accepts three parameters: a Gravity constant, an … Read more

Android TextView Example

Here we will create an app containing a TextView and a Button, and in which text of the TextView changes on clicking the Button. Step 1: Create a new project and name it textviewexample. Select File -> New -> New Project. Fill the forms and click “Finish” button. Step 3: Open res -> layout -> xml (or) main.xml and add … Read more