Friday, June 3, 2011

Hello World with Android

This post shows how add components to the interface of the application.

Still no need programming  :)  :)
Did you configure the Eclipse environment?  If not go to before post and get it configured. 


LETS START YOUR FIRST ANDROID PROJECT
Start to create new project with      File > New> Android   if it not available there FILE>NEW>OTHERS>ANDROID , then select the "Android Project" from the list.


Then it will popup windows with some jargon. but things in this window important to understand for further developments. let's see one by one. I know this may somewhat boring telling about settings and bla bla bla without entering to the seen, but just be patient for 2 minute to get an idea about this stuff :) 


  1. First asking Project name it pretty obvious and give a name you preferred.
  2. Content select the "Create New Project in Workspace", as it mention it create folder structure and the base codings and files in the workspace folder. for this moment select this this option because we don't have external source yet. (easily - don't mention about that in this moment )
  3. Next we meet "Build Target" box to select a preferred Android platform, now lets select the Android 2.2 because it simple and bug fixed version available. Exhausted reading ? let see the picture :)    
    Android 2.2 Platform : http://developer.android.com/sdk/android-2.2.html#api
    I'm not asking you to read this all, still I also haven't, just want to make you aware about availability of the information. just skip reading ;) 
  4. Application Name : give a name for application
  5. Package name : (Important)
    This is a name that should unique globally because when you going to host your application in market place your package name should unique or different from other already hosted application. otherwise the Market would reject the second one due to the “unique App package name across Market” rule.
    For this simple test it not a big problem just give a name you preferred, but don't forget before fact.
  6. Create activity :
    Give a name as you preferred for this too, this is the name of activity class, we discuss further about Activity class in next few posts.
  7. Min SDK Version : 
    This number available im last coloumnn of the "Build Target" table. this set of values call "Adroid API Levels". API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform.

    Further Readings : http://developer.android.com/guide/appendix/api-levels.html
    Again don't worry about this detailed stuff, for now just put the number in front of you selected API ( For Android 2.2 it is '8') simply check before picture.
    But be aware about these thing, it will help you.
                   YES.........! You Create It ................. :) 
---------------------------------------------------------------------------------------------------------------------------

Now You can see folders and set of files in Eclipse Package Explore as this picture shows. I have expand tree to show you :)

Don't get confuse with these fancy file name and other longer list of items. those are not danger as you see. 

Just double click on the Layout > main.xml file.
Then it open in a tab as below picture 


Can you See "HelloWorld " on a Black rectangle ?yah ......................... ! :) that is the screen of the Android phone and this is how look like your application.

Let's  run the application in virtual environment that we setup before as "Droidx"
Right Click on the project name > Run As > Android Application.

Then your Console window get busy and drop set of wordings on it, this get some what time to start Android environment, Don't get confuse. I also close and open it 3,4 times, thought it was stuck.  But wait until it open. if you are waiting below shows BLUE bracketed lines it common, not an error. wait it will Start. If you see clearly in that picture also it spent 3 minutes to up. (check Left Time stamps :) )


OK............ Can you see your HelloWorld application on the Virtual env phone view. ? 

GOT IT .........?
Hurre..........................i !

OK guys now we have started the development of ANDROID application, keep in touch.

In Next post I'll discus how customize the window and about Layouts/ "main.xml".

No comments:

Post a Comment