Sunday, 7 September 2014

How to Create Andriod Project : Hello Andriod

In this article we will discuss about "How to Create Andriod Project using Eclipse"

we have no'f tools to develop andriod applications like eclipse,visual stuido, andriod studio, presently i am using eclipse.--open eclipse--File--New --Andriod Application Project


in this we specified

Application name :  name of application display in tablet or mobile.

Project name :  which creates a folder at andriod workspace.

package name : which our package/library for Currently implementation code is packaged into to it.

Min SDK :  lowest version of our application supports.
Max SDK : highest version of our application supports.
Compile with : Andriod runtime for execution code.
Theme :  theme is to support for good design.


Activity name and custom/predefined logo && location of project ---giving option/control to developer as optionals.



then, we can create our own custom text and images/logos or utilize andriod supported images also.
and select one of templet of andriod predefined templets as per our requirements. example our project requires any actionbar support ---choose--Actionbar templet this below image does has that templet.



these templets are available based our ---project creation environment(Min,Max SDK's, compile...ect).--our first above image project settings.

once andriod project is created :
in this project structure : we have

src:-  implementation as a package // com.andriodproject.helloandriod.

gen:- our source code written in java language
      com.andriodproject.helloandriod
         -R.java. // deleted by our self--andriod runtime will create automatically every time.

Andriod 4.2.2
       andriod .jar file. which has predefined packages, which placed under

G:\Softwares\adt-bundle-windows-x86_64-20140702\sdk\platforms\android-19

this platfrom is selected by it self eclipse editor while choosing 

Complie with : API level--below .jar file will be andriod runtime will take the platfrom of apporiarite envirnoment for andriod project compliation.

G:\Softwares\adt-bundle-windows-x86_64-20140702\sdk\platforms\android-19
G:\Softwares\adt-bundle-windows-x86_64-20140702\sdk\platforms\android-20
G:\Softwares\adt-bundle-windows-x86_64-20140702\sdk\platforms\android-L

so that once the project is created with Min and Max SDK, then we simple changes in AndriodManifest.xml.--> also project will not run because the the project platfrom/compile platfrom for execution excepting respective .jar file. otherwise "unable to resolve target andriod-8"

bin : andriod apk & manfiest.xml

res : which has various sub folders as per our application resources we need to take respective folders and design the application.

layouts, values, colors,,...ect  base on resources.

Activity Name : MainActivity
Layout Name   : activity_main      //  graphical style and activity_main.xml.





this is best pratice to declare variables/string values in Values folder. for accessing styles, string values,images,colors...base on type of resource define respective resource files in respective folders.

How these values are accessed through xml to R.java file.

activity_main.xml
strings.xml
styles.xml



strings.xml

<resources>
    <string name="app_name">HelloAndriod</string>
    <string name="hello_world">Hello world!</string>
    <string name="hello_demo">Welcome to android!</string>
</resources>

MainActivity.java



then these variables / resources accessble in java program as like

R.string.hello_world
R.string.hello_demo
R.string.app_name
R.drawable.andriod

setContentView(R.layout.activity_main);    as well

R.java

        public static final int activity_main=0x7f030018;
        public static final int app_name=0x7f0a000d;
        public static final int hello_demo=0x7f0a000f;
        public static final int hello_world=0x7f0a000e;


No comments:

Post a Comment