Friday, February 3, 2012

06. Overview of the Android

9:37 AM
In this lesson we talk about Android platform. Firstly we will look at the architecture.

  • Runs on top of Linux 2.6
  • Dalvik virtual machine optimized for mobile devices
  • Integrated browser based on the WebKit engine
  • Optimized graphics with OpenGL ES
  • SQLite database for structured data storage

Now let's talk about Android versions. Because android has been progressing really fast phase.
  • Android 2.0/ 2.1 Eclair 
  • Android 2.2 Froyo
  •  Android 2.3 Gingerbread
  • Android 3.0 Honeycomb (Tablet version)
  • Android 4.0 Ice Cream Sandwich (Combination of Gingerbread and Honeycomb)

  • Applications are written in the Java programming language.
  • Compiled into an Android package file (.apk).
  • Each application runs in its own sandbox and Linux process.
  • Applications consist of components, a manifest file and resources.
  • Components :
                -    Activities
                -    Services
                -    Content providers
                -    Broadcast receivers

  •  An activity represents a single screen with a user interface.
  • Most applications contain multiple activities.
  • When a new activity starts, it is pushed onto the back stack.
                 - In the user's application, in the first screen that user sees they click something to launch in another activity. That initial activity is paused and the new activity is come to the front. If the user hit the back key, it actually show the one before activity again. This concept is back stack.
  • User interface can be built with XML or in Java.
  • Monitor lifespan through callback method like onStart(), onPause(), etc.

  • Services perform long-running operations in the background.
  •  Does not contain a user interface.
  • Useful for things like network operations, playing music, etc.
  • Runs independently of the component that created.
  • Can be bound to by other application components, if allowed.

Content Providers
  • Used to store and retrieve data and make it accessible to all applications.
  • Are the only way to share data across applcations.
  • Exposes a public URI that uniquely identifies its data set.
  • Data is exposed as a simple table on a database model.
  • Android contains many providers for things like contacts, media, etc.

Broadcast Receivers
  • A component that responds to system-wide broadcast announcements.
  • Examples include when the screen turns off, the battery is low, etc.
  • Applications can be initiate their own broadcasts.
  • Broadcast receivers contain no user interface.
  • They can create status bar notifications to alert the user.

  • Applications must have an AndroidManifest.xml file in its root directory.
  • Presents information about the application to the Android system.
  • Describes the components used in the application.
  • Declares the permissions required to run the application.
  • Declares the minimum Android API level that the application requires.

That is the quick overview of the Android platform.

Thursday, February 2, 2012

05. Install ADT plugin for Eclipse

12:16 PM
Now you have installed Eclipse. ADT plugin helps to create Android project in Eclipse. Go to the below url to download ADT.


Current version will show under the ADT plugin for Eclipse. Click on that version and find the download link.

We actually download and install it directly to the Eclipse. We can see the repository url here. We want to copy this to the clipboard and go to the eclipse. Select the Install New Software under the Help.
Basically this is asking us to give a site which we can download the software. Here we paste that url.
Then click Add to added as a site.

It searching that site to see what is available for us to download. After it done, select the Developer tool check box to download all the files and click Next.

Then choose options accordingly below screenshots.

After the installation, restart the Eclipse. You should see the below Android commands in the tool bar.

Here we can open the Android SDK manager, create a new Android project, create a test project and create new android xml file.
We need to tell eclipse where are android SDK is. It will show an error when you click on the SDK manager button. To setup the SDK manager to eclipse, click Window button and select Preferences .
Then click on Android and Browse SDK installation folder for SDK Location.


Now you can access the Android SDK manager clicking that button.
So with that you successfully downloaded and installed the Android Gingerbread SDK to Eclipse. And you have android development tool. Now you have officially ready to get started with android development.

Wednesday, February 1, 2012

04. Download a developing tool (Eclipse)

10:20 AM
Here we use Eclipse as our developer tool. You can download it with following url.


Click this download link and choose any suitable version.

Here we choose to download Eclipse IDE for Java Developer version. 

No need to install Eclipse after the download. You should only run the eclipse.exe file.

It's better to create a shortcut in the desktop.

Tuesday, January 31, 2012

03. Virtual Devices

10:46 AM
When you testing your application, one of the thing you definitely have is Virtual device or Emulator. This allows to actually test your application here in the Desktop environment instead of haven't to go out to a real device.
So from the SDK manager click the "Virtual devices" tab and click "New" to create a new virtual device.

We wanna give a name for this virtual device. Let's give it as "Gingerbread_WVGA". Because our SDK version is Gingerbread  and we use WVGA resolution. So now on the target, we want to choose a API. Here we have only installed Gingerbread version. So choose Android 2.3.3 - API Level 10.
Emulator is able to emulate most features of the phone including the SD card. I'm going to enter 10,000 here. So the next feature here is Snapshot. This is really important. It support to speed up our emulator when running the emulator several times without close it. So enable it.
Then keep a skin size as a Default(WVGA800).
And keep other hardware properties also in default.
Now you can create a new AVD (Android Virtual Device).

Your system will take a little while to create it. When finish the virtual device, you should get this message.
 Click OK.

Now you can see your new virtual device in the "Virtual Devices" panel.
Another thing is make sure everything is running fine.Select it and click Start.
Now it's presenting a window with some options.  Select Launch.

Then you can see the Emulator is starting up. Now remember that we didn't have any previous snapshot to launch from. So we need to wait for Android boot up. 

Before the boot
After the boot


 Now everything is booted up. We can view all the things as a android phone. We can access the Main menu and there are a lot of applications.

Let's meet with our another lesson.