This
is our first Tutorial on Android Programming
Ø
In
this tutorial I am going to explain “How to Get Started With Android”
Dont
you need some knowledge about Android?
As
you think (beginners), Android is an Operating System. Android is an Open Source Operating System
based on Linux Kernal. Android is
developed primarily for touchscreen mobile devices such as smartphones and
tablet computers . Android is the world’s most
widely used mobile platform.
Let’s Begin without much Intro
First
you need to set up development environment.
What
all things you need
- Java Development Kit JDK (no need of netbeans) Link
- Install the ADT plugin for Eclipse (if you’ll use the Eclipse IDE). Link
- Download the latest SDK tools and platforms using the SDK Manager.
Now
You Need to Familier with some Terms
- 1. SDK - The Android SDK provides you the API libraries and developer tools necessary to build, test, and debug apps for Android.
- AVD - An Android Virtual Device (AVD) is an emulator configuration that lets you model an actual device by defining hardware and software options to be emulated by the Android Emulator.
- Application Name is the name of application that appears to users. Let it be "First App."
- Project Name is the name of your project directory and the name visible in Eclipse.
- Package Name is the package namespace for your app (following the same rules as packages in the Java programming language). Your package name must be unique across all packages installed on the Android system. For this reason, it's generally best if you use a name that begins with the reverse domain name of your organization or publisher entity.
- Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set.
- Target SDK indicates the highest version of Android (also using the API level) with which you have tested with your application.
- Compile With is the platform version against which you will compile your app. By default, this is set to the latest version of Android available in your SDK.
Get you Hands Dirty
I assume that you have installed all the Preqs mentioned above, and
unzipped Android ADT+SDK+Eclipse
Follow the steps
1.
Open Eclipse IDE from where you unzipped it.
2.
File->New->Android Project
Getting-Started-With-Android-image1 |
3.
Application Name - First
App, Package Name - blog.arrogancetutorials.firstapp (see image 1)
4.
Next
5.
Next
6.
If you want to change icon, do it here -> Next
7.
Check ‘Create Activity’, select Blank Activity->
Next
8.
No change -> Finish
Now your Hello World App is ready, this is auto generated
by the Eclipse.
Important Folders in an Android Project
1.
SRC – Where the source files are placed.
2.
Res -> Layout – Where the Layouts(What We See)
are placed.
Getting-Started-With-Android-image2 |
Explore this folders, you can see
“MainActivity.java” inside SRC ->Package (marked
2 in Image).
“activity_main.xml” inside Res -> Layout
(marked 3 in image).
Image explanation (should remember this in coming tutorials too)
- AVD Mentioned above
- SRC Mentioned above
- Layout Mentioned above
- Palette -> You will get the necessary GUI controls from here.
- Workspace -> You are designing in this space, your app will look like what you see here
- Graphical Layout -> It is selected in the image as default, that is why you are able to see the GUI of the layout
- Activity_main.xml -> This is the XML file of the GUI layout
- Run button -> hit this button after development to run you app *
- Structure -> You can see all elements present in the Layout and you can elect it from here.
- Properties ->Here you can change properties of all the controls in layout.
*You have to setup AVD to run the app.
Talking About “First App”
Open “activity_main.xml”
Click on ‘TextView’ in Structure, you can see the
properties of the textView now. The text view is displaying “Hello World”. In
properties window ->Text you can change the text displayed by the TextView
(It is not the right way)
Now our application is ready to Run, before Running
you need to setup AVD