Wednesday, September 5, 2012

Using Buttons in Android

Hi Friends today we will learn to use the Buttons, EditText , and TextViews.
EditText are used to take input from user. (like Textbox in java).
TextViews are used to show something (like Label in java.)

So what we are going to do ?
We will create an application "Calculator" which will perform addition and subtraction.
We will have two EditText to take inputs.
A text view to show the result
And two buttons:
Add Button : to perform addition
Subtract button: to perform subtraction.

Create a new Project named as "Calculator" and give the name "CalculatorActivity" to your activity.

Edit the main.xml file

edit your main.xml file add "Butttons", "Textviews" and "Edittexts" ,
It should like below.( you can just copy the code and paste in amin.xml file)