Friday, February 10, 2012

What you need to begin with android

What You Need to Begin
                Because Android applications run within the Dalvik virtual machine, you can write them on any platform that supports the developer tools. This currently includes the following:

  •         Microsoft Windows (XP or Vista).
  •          Mac OS X 10.4.8 or later (Intel chips only).
  •          Linux

To get started, you’ll need to download and install the following:

  •          The Android SDK
  •          Java Development Kit (JDK) 5 or 6
What comes with Android SDK?
·        The Android software development kit (SDK) includes everything you need to start developing, testing, and debugging Android applications.

  •          The Android APIs
  •          Development Tools
  •          The Android Emulator
         The emulator is the perfect tool for testing and debugging your applications, particularly if you don’t have a real device (or don’t want to risk it) for experimentation. The emulator is an implementation of the Dalvik virtual machine, making it as valid a platform for running Android applications as any Android phone.

  •          Full Documentation
  •          Sample Code

Android Market

ž Anyone can download the SDK (software development kit) and write applications for Android phones.

ž Google doesn't screen developers or applications.

ž These apps can be downloaded from the Android Market.

Linux Kernel

ž Android is based on the Linux 2.6 kernel.

ž  Core services (including hardware drivers, process and memory management, security, network, and power management) are handled by a Linux 2.6 kernel.

Dalvik Virtual Machine

ž Based on Java Virtual Machine

ž Optimized for mobile and embedded devices

ž .class files are converted to .dex files for execution in DVM

ž The final output file is an .apk file .  It consist of
         Davlik Exe  +Resources = .apk 


5 main components of an Application
  •           Activity
  •           Intents
  •          Service
  •          Content Provider
  •          Broadcast Receiver

·        An Activity is an application component that provides a screen with which users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map. Each Activity is a “screen”.
  •               User actions tell an Activity to start another Activity, possibly with the  expectation of a result.

  • ž         For example, an email application might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails.
  • ž     Although the activities work together to form a cohesive user experience in the email application, each one is independent of the others
  •  ž The target Activity may not necessarily be in the same application.
  • ž          Processing stops when another Activity is “on top”.
  • ž  An activity is implemented as a subclass of Activity.


It is something like message passing mechanism. Using Intents, you can broadcast messages system-wide or to a target Activity or Service, stating your intention to have an action performed.

      Services are the invisible workers of your application. Service components run invisibly, updating your data sources and visible Activities and triggering Notifications. They’re used to perform regular processing that needs to continue even when your application’s Activities aren’t active or visible.
  •  ž Run in background
  • ž         Play music, alarm clock, etc
  • ž        Secured using permissions
  • ž  Callers may need to verify that Service is the correct one
  • ž       A service is implemented as a subclass of Service 

Content Providers
      Content Providers are used to manage and share application databases. Content Providers are the preferred way of sharing data across application boundaries. This means that you can configure your own Content Providers to permit access from other applications and use Content Providers exposed by others to access their stored data.

  • ž         Generally SQL backend
  • ž         Used to share content between apps
  •  ž Access controlled through permission tags

ž A broadcast receiver is a component that responds to system-wide broadcast announcements.
ž Many broadcasts originate from the system—for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured.
 A unique aspect of the Android system design is that any application can start another application’s component. For example, if you want the user to capture a photo with the device camera, there's probably another application that does that and your application can use it, instead of developing an activity to capture a photo yourself
In order to run android u need to have java, eclipse and android tool kit.
l  JDK is required to run Eclipse and develop Android applications.
JDK installation
Installation Process
ü Download the latest version of JDK from                                                                               
ü Install the downloaded JDK
ü Add the path of the JDK's 'bin' directory to the system
For Linux, add it to ~/.bash_profile:# vi ~/.bash_profile
PATH=$PATH:/usr/java/jdk1.6.X_XX/bin like # source ~/.bash_profile
For Windows, add it to Environment Variables:

ü If you have successfully installed JDK, you should be able to see following messages in your command prompt window or terminal:
                                         # javac –version Like javac 1.6.X_XX
Installation Process
ü Download the Android SDK from:
ü Unpack the compressed file into a location you prefer.
ü Add the path to the SDK tools directory "<SDK ROOT>/tools" to ~/.bash_profile (Linux) or Environment Variables (Windows)
ü If you have successfully installed the Android SDK, you should be able to see following messages in your command prompt window or terminal:
                                                # dw –version dx version 1.1
Installation Process
ü Download Eclipse from
·        Unpack the downloaded file into a path you prefer. For example,
               /home/user1/eclipse (Linux)
                C:\Program Files\eclipse (Windows)
·        Add the path to .bash_profile (Linux) or Environment Variables (Windows)
v Test
If you have successfully installed the Android SDK, you should be able to see following application:
                                                                  # eclipse

l  ADT (Android Development Tools) provides a powerful, integrated enviornment to build Android applications.

l  Installation Process (based on Eclipse 3.4 Ganymede)
o   Start Eclipse, then select Help > Software Updates....
o   In the dialog that appears, click the Available Software tab.
o   Click Add Site... and enter following location:
o   or
o   Back in the Available Software view, select the checkbox next to Developer Tools and click Install....

o   On the subsequent install window, check both "Android Developer Tools" and "Android Editors".

o   Accept the license agreement and click "Finish".
o   Restart Eclipse.
o   Modify Eclipse preferences to point to the Android SDK directory:
·        Select Window > Preferences... to open the Preferences panel.
·        Select Android from the left panel.
·        For the SDK Location in the main panel, click Browse... and locate the SDK directory.
·        Click Apply and then OK.
Sample Project - "Hello, Android"
l  Create "HelloAndroid" project.
·        Select the File > New > Project menu item and select "Android Project" and click Next.
·        And write a code which is going to print hello world.
·        Select the Run > Run Configuration menu entry.
·        Highlight the "Android Application" entry, and then click the icons in the top left corner (the one depicting a sheet of paper with a plus sign in the corner) or simply double-click the highlighted entry.
·        Click "Apply" and then "Run".


Post a Comment