As in Previous post i have explain you about the Basic’s of Android Programming, its installation and tutorial of simple “Hello world” program . That post includes the following points:
- What is Android Programming?
- From Where to start the Android Programming?
- Tool needed to begin the Android Programming.!
- Installation Instruction of those tools.
- Simple “hello world” Example..!!
If you missed that post then Read: Android Programming Basics
Now in this post we moving ahead from the console level to GUI and i am going to post a tutorial about simple GUI term called as “BUTTON”.
Step 1: Create a Android Project.
Well i don’t think i need to put more words on this that how to create a Android Project. If you have already know then open the Android IDE or Eclipse if you are using then. Give a name of Project and once done move to next step.
Step2: How to manage Button control in Android.
The Android SDK includes two simple button controls for use within your program:
- Button (android.widget.Button)
- ImageButton (android.widget.ImageButton)
The basic difference between them is that the ImageButton support the image on the button rather than following only text as Button Control do.
To add a Button on your code just drag and copy the code and rest you know…..!!!!!
<pre name=”code” class=”xml”><?xml version=”1.0″ encoding=”utf-8″?>
Step4: Running the code.
Once you done the copy paste then run the code for desired output.
Once you run the code you will see the output like this.
Congratulation you have successfully run the program.
This is all for just adding a button. Do practice guys soon you all will get the next part of Android Programming which is as Layout Management and Handling event.
Till then good bye.