Search Wikipedia

Search results

Oct 11, 2013

Creating my first Android Project

Being familiar to Eclipse environment for Android development

Today i am gonna  understand the full overview of eclipse environment for developing an android application.

OK. Then lets start.

First of all i create a new android project .
Go to File->New->Android Application Project
Then a new window will appears.
Creating a new android app

 
Application Name:  Name of application(eg: Myfirstapp, Camcap)
Project Name: Name of my project(eg: Myfirstapp)
Package Name: Name of my android package and it should be unique(eg: com.kais.myfirstapp)

Then i click to Next and new window will appears. I don't need to do anything in this window so click next again . Now another window appears. Here i can change my app icons.In my case i willn't change my app icon so it will be default as it is.

Changing app icon
Click next button then a new window will appears.In this window I need to create an activity. In android app, there could be many activities. As our requirement we can choose different kinds of activities. Here I need just a simple blank activity so by clicking next I create a blank activity.
Creating an required activity



 In new window, I need to give name of activity and layout.
In navigation type , there are different options. Navigation is the way how we interact with activity. It could be fixed tap ,scrollable and dropbox. In my case I just choose None.
Then I just click Finish button and now I am ready for my code.

Creating new blank activity with optional inner navigation


Now if u also try these all steps , u will get this window like mine.

Overview of eclipse for android development


There is Package Explorer  in left side as shown in below figure. Here I need to know about followings:

1: Source code -> Myfirstapp.java (It is the place where I write my java codes)
2: Generated code-> R.java (I needn't to care about this, its self generated code)
3.Resources-> In this we keep our user interface datas like images,sounds,strings value. And under the          option of layout there is main.xml where I write my UI xml code.
 4.Configuration-> AndroidManifest.xml (There are four building blocks to an Android application i.e                activity,intent,service and content provider and as our requirement we should list                them in our file)


Package Explorer
Most basic thing to know is that android consists of two languages one Java and another XML.

I go to res->layout->activity_main.xml


XML provides both direct coding and drag n drop option
In XML files i can define Strings, layout window, create GUI controls and assign even handlers. The java method will read the layout from XML file and pass it to setContentView(don't worry i will write about this in upcoming posts).

Opening java file from source file
Another important feature of android programming is manifest file. Everything which needs to be requested by an application must be include in manifest file.

Opening AndroidManifest.xml 
There requires a detail study about manifest file because it depends upon the types of applications like if i am creating an app which needs internet srvice then i must include internet  permission in manifest.

No comments:

Post a Comment

Did this post help you? Do you have any questions? Drop your thoughts here...

}