Pages

Friday, 28 February 2014

Android Development Basics

Android application development is mainly dependent on xml and java. Where xml is used to create application’s UI and java is used to handle events and other functionalities of applications.

XML file:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
   xmlns:tools="http://schemas.android.com/tools"  
   android:layout_width="match_parent"  
   android:layout_height="match_parent"  
   android:paddingBottom="@dimen/activity_vertical_margin"  
   android:paddingLeft="@dimen/activity_horizontal_margin"  
   android:paddingRight="@dimen/activity_horizontal_margin"  
   android:paddingTop="@dimen/activity_vertical_margin"  
   tools:context=".MainActivity" >  
   <TextView  
     android:layout_width="wrap_content"  
     android:layout_height="wrap_content"  
     android:text="Hello World " />  
 </RelativeLayout>  

This is the layout of basic xml file for printing Hello World.

So to begin with android application development you require basic knowledge of xml but even if you don’t have any knowledge of xml don’t worry in our further tutorials I will try to explain every possible terms used in android xml file.

Xml files reside under res---layout

Java file:
 import android.os.Bundle;  
 import android.app.Activity;  
 import android.view.Menu;  
 public class MainActivity extends Activity {  
      @Override  
      protected void onCreate(Bundle savedInstanceState) {  
           super.onCreate(savedInstanceState);  
           setContentView(R.layout.activity_main);  
      }  
 }  
This is the basic structure of your applications java file. So it is must to have basic knowledge of java to begin with android development.

Java files reside under src--- your package name

One more important part of your application is Android Manifest file
A manifest file includes some basic information needed by system before running any application.

Now before moving on to real application development you people need to download eclipse and setup the environment.

A good tutorial on setting up environment can be found here

No comments:

Post a Comment