Thursday, December 13, 2012

Android Programming Introduction


    ANDROID PROGRAMMING - INTRODUCTION

    Android that is mobile platform that gives us the possibility of developing through the Java programming language. It can also be developed with another languages but the most used one is i think Java J I will tell you the android structure from the point of programming below.
    If you developed java web applications before it is easy to learn android structure but if not maybe it is hard at the beginning after some time it will be easy do not worry.
    There is a project folder with the following sub folders
Src : that has a package of java files that are developed by you. Your java program will be in this folder.
Gen:that folder has a special file named as R.java that is created for your indexes and should not be changed manually. The program creates and updates at the build times.
Androidx.y library : Android has lots of versions such as 2.2, 2.3, 2.4... and you should choose the version of the android before you create the project.
Assets : You can store your special files in there such as your text files, xml, fonts musics and video...
Bin : it contains your projects .apk file that you can use in mobile for installing.
Res
                àdrawable-hpdi
                àdrawable-lpdi
                àdrawable-mpdi
                àdrawable-xhdpi
                àlayout
                àmenu
                àvalues
                àxml
The drawable-x files above includes images that your program uses. Layout folder contains your activites layouts. Menu folder contains menu items xml files. Values folder contains the value files such as the equations of the strings this is equivalent of the application.properties file on struts :) . Xml folder contains the specialized xml such as for some utility development tools.
AndroidManifest.xml
Android Manifest : this is the most important file in the project. It contains all the activites, services that will run at work. Also it includes all necessary permissions and some limitations such as device screen and also the supported sdk versions.


At the Java Side you should know these
Activities :
Activities are the main building block for your application. Setting view to the device can be achieved by defining activity. To define Activity, you should implement Activity interface first then it needs some methods that i will explain, you need to Override them ;
protected void onCreate(Bundle savedInstanceState) {
this is the function of setting view to the screen. In this function your program will have road. You need to set your content view from xml to the screen or you can create your own layout programmatically from Java code.  And also there is one more function
public boolean onCreateOptionsMenu(Menu menu) {
This is the basic menu function that you can get your menu to the screen. Building menu is in another post.

When you open a new android project, you will have a default Hello World project that you can trace.

No comments:

Post a Comment