Home » Tutorials » What is Android Programming Language

What is Android Programming Language

What is Android

It is an open source operating system (Linux based) for tablet computers and smart phones. Andy Rubin, Nick sears, Rich miner and Chris White founded “Android Inc” in 2003. Later “Android Inc.” was purchased by Google in 2005.


Features

  • Integrated browser
  • SQLite
  • Support for media
  • GSM telephony
  • Application framework
  • Optimized graphics
  • Camera ,Compass, GPS
  • Bluetooth, Wi-Fi ,EDGE and 3G
  • Support multi-touch and additional hardware like barometers, accelerometers, etc.

Benefits of using Android

  • SDK is powerful and simple.
  • As it is an open source, so no licensing is required. You have to pay no fees for development and distribution.
  • Development can be done in many operating systems like Windows, Linux and Mac.
  • Android applications are in java. So 3rd party java library can be imported easily.
  • Documentation is good.

System Requirements

Minimum Software and Hardware Requirements to develop Android applications

Operating Systems

  • Windows XP ,Windows 7 , Windows Vista
  • Mac OS X 10.5.8 or higher version (only x86)
  • Linux (tested on Lucid Lynx, Ubuntu Linux)

Software Requirements

Eclipse IDE
  • The version will be 3.6.2 or higher.
  • Eclipse Java Development tools plugging is also required.  Although it is present in Eclipse IDE packages in maximum cases.
  • To download Eclipse or update it go to this link.
  • Eclipse Packages are of different types. To develop Android applications, you can download any one of the below packages:
    1. Eclipse IDE for Java EE Developers
    2. Eclipse IDE for Java Developers
    3. Eclipse Classic
JDK 6
  • To download this , follow the this link.
Apache Ant
  • The version will be 1.8 or later.
  • To download, click here.

Hardware Requirements

Features
Minimum needed
Comments
Android Platform (each) 150 mb One platform is essential
Memory 256 mb Flash External , 128 mb RAM Android can run with less memory than this as mentioned.
SDK Tools 35 mb Essential
Storage Micro or Mini SD Not mandatory during initial development
SDK Add-on (each) 100 mb Optional
Camera 2MP CMOS Not mandatory during initial development
SDK Platform-tools 6 mb Essential
USB Standard mini-B Required
Offline documentation 250 mb Optional
Bluetooth 1.2 or 2 Not mandatory during initial development
Chipset ARM-based ARM architecture is required
Primary Display QVGA TFT LCD or larger

Android Architecture

The following diagram shows the architecture of Android.

android-architecture

Applications

Android comes with different types of applications like Browser, email, calendar, SMS program, maps, etc. All of them are written in java programming language.

Application Framework

Android is open source; which helps developers to build extraordinary applications using this platform. Developers can access location information, run background services and device hardware for free. They can fully access application framework APIs. The application architecture is designed in such a way so that components can be reused easily.

View System:

Different types of views are present here; like “List view”, “Linear Layout” , “Tab Layout”, “Table Layout” , etc. You can use them according to the requirement of your application.

Content Providers:

It enables an application to fetch data from some other applications (like contacts). It also enables applications to share their data.

Resource Manager:

It gives access to non-code resources like graphics, localized strings, layout files, etc.

Notification Manager:

An application can display custom alerts with the help of this. Alerts are displayed in the status bar.

Activity Manager:

Lifecycle of an application is managed by this. It also provides common navigation backstack.

Android Libraries

Android consists of large number of C/C++ libraries, Surface manager, SGL, Media libraries, LibWebCore, Free type, 3D libraries, SQLite and other core libraries.

Android Runtime

Every Android application used to run in its own process with its instance of Dalvik VM (VM stands for virtual machine). Dalvik is written in such a way that devices can run efficiently more than one VMs. The format of Dalvik executable file is “.dex”. For low-level memory management and for threading Dalvik virtual machine relies on Linux kernel.

Linux kernel

Between the hardware and software platform it acts as an abstract layer. For core system services like network stack, security, memory and process management Android used to relies on Linux.

Android Program

Here we are going to discuss a simple basic program of Android. The name of our Android project is “HelloWorld”. The code of the project is given below:

package com.gregrjacobs.helloworld;
import android.app.Activity;
public class HelloMain extends Activity{
  public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
  }
}

Explanation:

The first line is the “Package name”. In the next line, to run our application we have imported OS bundle and activity function. Next line is the “class” that says when this application will start. Here we also set the view of the screen. Here we are using only one view. But based on your application you can provide any view.

Detailed explanation is given in the later part of this topic.

Note:

Before you start to make your own Android application you have to set your computer correctly for developing this. The pre-requisites for developing an android application are given below.

Pre-requisites for developing Android application

1. To start development of android applications , download “Eclipse” (“Eclipse IDE for Java EE Developers version”) from the below link:

Download link

2. Now download “Android  SDK” from the below link:

Download link

This will help you to hook SDK into eclipse.

3. Now you have to setup and start Eclipse using Android SDK. To do this , follow the below steps:

1. First of all, download a package for including SDK into Eclipses referenced files. For this, go to “Help” and then click “Install New Software”.

Android image_2

2. In the location box enter the url –“https://dl-ssl.google.com/android/eclipse”and click “ok”.

Android image_3

3. Click both boxes and go to the next screen. Make sure that “Android Development Tools” and “Android DDMS” both are listed.

Android image_4

4. Accept the License terms and click Finish.

5. Now restart Eclipse.

4. After downloading the zip file of Android SDK from the above said url, unzip the file and save it in C drive with the name “SDK”.

5.  Enter into this folder and click the setup icon. Now a screen will display with all the available updates that you can download. Download the latest one and click “Virtual Devices” .Here you will create your first emulator. But if no update is available, then set the setup client for using http in place of https.

6. Name does not matter for creating emulator. Only that matters, you have to set a version. Here we will choose Android 1.5 because if you want to market your application then you can reach to large number of people.

7. Now open Eclipse. Click “Window” button and go to “Preferences”. On selecting Android option you will see a blank screen having a browse button in the right. Click the browse button and select the “SDK” file and click “Apply”. If you are able to see different versions of Android SDK on the blank screen then installation is correct.

Android image_8

8. Press “ok” and you can now start to develop your android application.

Creating new Android project

1. To start development open Eclipse .Now  go to “File” then “New” and click “Project”. Select “Android Project” from “Android folder” and press “next”. If your Android SDK is updated correctly, then you will see the below screen.

Android image_6

2. Here you have to put the below information such as “Project Name”,  “Application Name”, “Build Target “,”Package Name”, “Min SDK Version” and “Create Activity”. The meaning of these terms are given below:

    1. Project Name: Here you have to provide the name of your project. For example the name of our project is “HelloWorld”.
    2. Application Name: Here you have to provide the name of your application. The name of our application is “HelloWorld”. You can change your application name on later time.
    3. Build Target: Here you have to specify the version of API you are going to use in your project. For example in our project we are using “Android 1.5”.
    4. Package Name: Here you have to provide the name of your company’s standard package. For example in this we are using “com.gregjacobs.helloworld”. But this can be anything.
    5. Min SDK Version: Here you have to provide a number for targeting a specific platform. AS we are using Android 1.5 as our build target, so “3” will be our minimum SDK version.
    6. Create Activity: Check this option as this will help you a lot for developing your application.  Here you have to provide a name. In our project we are using “HelloMain”.
    7. After providing all information, click “Finish” button.

3. This will create the major part of our project. Now navigate to the “res/ folder” and locate “main.xml” file. This file holds the layout of our application such as labels, textboxes, etc. In our project we are using “Linear Layout” (capable of organizing items into a column or a single row) and you can see that in main.xml file.

Note:  In our project it is not necessary to change this layout as here we are just displaying a text.

4. Now go to the “strings.xml” file .This file acts as a cover between java and “main.xml” file. Here we are changing the string called “hello” from “Hello World, HelloMain!”  To  “Hello Android, Hello World!”

5. After doing this we are going to navigate to the package name we created and open HelloMain.java and this will contain the code to run the XML files we were just looking at. The first line will contain our package name that the java file is associated with. In the next line, we have imported the OS bundle and the activity function that will run our application. Later on when we explore adding textboxes and labels, we will be importing widgets into our files and we will put the imports just under these two shown above. Next is our class that basically says when the application starts up, set the view of the screen to the layout labeled main. This is interesting in the sense that you can design many different layouts depending on the state you application is in. Of course with a hello world program we only need this one layout but the option is there for you to experiment with.

6. Now go to the” package name” and click “HelloMain.java”. Here you will find the above code to run the XML file. In the first line the “Package name” will display. In the next line, to run our application we have imported OS bundle and activity function. Later on, if we will explore adding labels and textboxes, then we have to import widgets into our project files and we will place these imports just under this two above lines. Next line is the “class” that says when this application will start. Here we also set the view of the screen. Here we are using only one view. But based on your application you can provide any view.

Android image_1

7. When everything is complete, run it on emulator. To do this, navigate to the top of eclipse screen .Here you will see a green button with play sign. Press this button. A screen may display here. Select Android Application (our project type) and click “ok”.

8. The emulator will start to loading up. During first loading may be you have to face some problem but after first loading no problems will occur. When loading is complete, it may ask to click “Menu” for unlocking. You can do this by clicking menu (It is present just under the screen). There is no need to navigate for loading your project. It will do this by itself and finally produce the below result:

Android image_7

So this is all to get you started with Android programming. Since Android is an open source product, you can go on developing on it with free license and you are even free to customize its core if necessary. Happy programming!

Leave a Reply

You must be logged in to post a comment.

© 2015 iLoveAndroid.com. All Rights Reserved. Privacy Policy