Clouds consist of a huge amount of particles of water vapor, reaching hundreds of millions. Clouds do not have central control and basically go where the wind blows. With this perspective, the large number of client computers and servers on the Internet along with many different purposes and entities that direct control of its progress are like clouds. Add this to the wireless data revolution that the cellphone companies have brought us and really feels like we are all covered by a cloud of invisible computing power.
Since early electronic computers, there is a clear division of manpower between four main functional parts of a computer:
  • Input / output (I / O) that provide the interface with people / computer
  • Central processing unit
  • Volatile random access memory (RAM)
  • Nonvolatile memory
The first three parts put the “computer” in computers. It is the fourth part, where the assets of important data are usually stored, that has changed more radically with the advent of cloud computing. Important data assets reside in nonvolatile memory to be protected against power outage – regardless of whether the loss was deliberate. Generally, non-volatile memory devices are hard disks, but can also be solid state devices, such as secure digital cards (SD) and even tape devices (almost obsolete now). But these storage device has its limitations.
Time passes, the technology progresses and brought the computer networks, in which the assets of an organization’s important data can be centralized on a computer shared by several terminals and which can back up regularly, as a basic function needed IT . This model (known as the mainframe model ) offered many advantages – one being lighten the load that each site had terminal. Small offices with little more than a small terminal (keyboard, mouse, monitor and PC) can access gigabytes of corporate data and processing power of large mainframes without cluttering up the place – from which they were connected by wires.
The next major paradigm shift came with the network of networks known affectionately as the Internet, where computer systems absolutely gigantic (LANs) can serve large populations of small terminals anywhere in the world where a dish can be placed. The wireless remote nature of this configuration is known as the cloud.
Then came the personal digital assistants (PDAs), mobile phones and smart phones, for which the miniaturization of computers has progressed to the portable form factor, we know and love so much. Suddenly, intelligent terminals are in the hands of countless millions of productive people, producing and consuming information at prodigious rates.
From mid to late 90s, e-mail and World Wide Web were the most popular applications that dominate the cloud. Most people interacted with the cloud using a Web browser and found that the Internet was a relatively simple application. With the advancement of commercial successes such as Yahoo and Google servers, network connections and terabyte hard drives replaced as the local non-volatile storage devices preferred. Like many visionaries predicted progressive thought, the cloud has become a modern utility, like water, telephones and electricity. Using the digital mobile phone network as an Internet Service Provider (ISP), the cloud grew and uses millions of portable devices as the main tool to display the data residing on these servers.
As the clouds move and are changed by the winds of change, so did the paradigms under which these devices operate – the terminals have become smaller, more powerful and more portable, while the servers, similarly, were more powerful and better able to meet the needs of data users through virtualization software and the measurement of their use.
Companies no longer need to maintain large and expensive “parks” of servers 24 hours a day when there is another less expensive alternative: hiring such services through fully managed cloud hosting providers. Through virtualization, applications that previously ran on custom environments may be duplicated or “having created image” to run in the cloud server provider. And with the proper measurement of these services, the company will not need to pay high prices for those times when their services are being used minimally.
As hardware technology has moved on, the same occurred with software, and saw the creation of new applications. For example, location-based services that map businesses near the site where the cell tower or the global positioning system (GPS) has determined that you are. New markets tailored for download and testing programs and data files useful, as the Android Market. No doubt we will see further advances in these new unique applications of cloud computing – for example, companies could sort and select regional contact information, then automatically download the list of days of random calls to mobile phone based on Android representative regional sales.
Cloud computing, where mobile devices balance powerful servers, needs an operating system that makes the most of the system architects and developers can do on a small client computer. Android is the operating system.
Android Architecture
First, Android is a software stack for mobile devices. This means that top the list of priorities is the preservation of battery power and the efficient management of limited memory resources. There are five distinct layers to the stack of Android:
The core of the Acorn RISC Machine (ARM) Linux form the foundation upon which all other layers are. Linux is a proven technology that is highly reliable and the ARM processor family is known for high performance at very low power requirements.
The libraries provide low-level code reusable and sharable for basic functions such as functions, codecs – software for encoding and decoding of digital video and sound – rich graphics for presentation on a small monitor, support for Secure Shell for TCP / IP traffic encrypted the cloud as well as support for Web browsing component (WebKit), feature SQL database (SQLite) and standard C library functionality, expected in a Linux system.
The bytecode interpreter runtime Dalvik, very similar to the bytecode interpreter in Java ™, includes some distinct features that define uniquely the model of safety and energy conservation Android. Any application currently running, for example, has its own user ID and your own copy of the interpreter running processes to separate rigidly for safety and reliability.
The Android application framework lets you utilize and replace components as required. These high-level Java classes are highly integrated components that define the Android API.
The main applications include the Android WebKit browser, Google calendar, Gmail, Maps application, SMS messenger client, and an e-mail standard, among others. Android applications are written in the Java programming language and you can download many more Android market quickly.
Each Android application can be further divided into distinct functional units:
  • Activities
  • Intents
  • Services
  • Security Model
Activities are the modules of an Android application that spread out the base class Activity and define an interface that are based on a view that responds to events. If an application consists of three windows (for example, a login window, a window for viewing text and a file viewing window), each one is usually represented by a different class Activity.
The Android keeps a history stack for each running application from the homepage and you can click the Back to scroll back through this history of activities.
Attempts, such as activities, are a special class of application code that describe and define what an application wants to do. Attempts include a layer without targeting that allows sophisticated reuse and replacement of components. For example, an application can display a button labeled clients that, when clicked, displays a list of contacts who are their clients. And here enters a lack of direction: no need to use the default viewer for those contacts, but instead, you can substitute a different viewer.
For some applications, this can be a very powerful function of application integration. Possibly a topographic map is best for a specific display the default map view.
Classes as a BroadcastReceiver define code that runs when external events trigger the same. Events such as the firing of a timer or the touch of a phone can be tracked that way. Typically, such code does not display a window, but can use the class NotificationManager to alert the user about something that needs attention.
A service is an application running on a low level and without a monitor or UI. It is usually an application that should run long in the background. A perfect example is a software media player playing a song list. Despite a media player application to present a UI that allows users to adjust their playlists, the program passes control to the service to really play the songs from the playlist provided.
Security Model
The Android security model let’s programs have only their own data. If programmers wish to share data between queit a few different programs, they can set content providers for this purpose.
The power of free software should never be underestimated, as the power of free people and creative. Free of proprietary APIs and interests of businesses that generally obstruct progress in software engineering, the Android platform has a large developer community and very active, whose combined talents really make the sum greater than the parts.
Want to empower your programming career?
Learn how to program on the Android platform and, someday, will have millions of mobile phone users in its potential market – some of which may need their program.
The heart of Android is the Linux ARM. That in itself should inspire confidence in the ability of the importance of this platform to grow rapidly. Linux is a fast and secure operating system with many thousands of programmers familiar with it. Many Linux based systems are known to have an uptime of consecutive years online and view applications in the cloud – and that really defines reliability.
Development Environment: Eclipse, Windows, Linux
The developers have several options in relation to Android development environment. They can use the Microsoft ® Windows ® XP or Windows Vista ®, Macintosh OS X (v10.4.8 or later, x86 only) or the Desktop Linux (preferably Ubuntu). There is a software development kit (SDK) that can be downloaded to all these operating systems commonly used.
You can use a GUIIDE like Eclipse or NetBeans, Sun Microsystems, method or the famous “real programmer” from the command line and a default editor. The choice is yours.
Organizations can also put programs and data owners in Android, thanks to the types of software licenses used. This prevents them from escaping the platform, but does not limit consumer choice. It’s a winning combination for all parties.
Developer Resources
There are several resources in the cloud to develop Android, including several community forums and wikis Android, as well as several blogs related to Android programming. The main company that directs the phenomenon Android, Google, is fundamentally a communications company and therefore has many useful forums (known as Google Groups ) for communication between developers of different skill sets and talents.
The links section of Android Resources cannot even begin to show the vastness of the universe Android. Cloud computing – and Android, specifically – is something very, very, very interesting.
Time will tell what new innovative applications of cloud computing will be created in the next few years trying to overcome with all the creations of the great developers who preceded them.

Android Viewflipper Example

Here is a small and easy example of how to use viewflipper in android. Android

 to add multiple views in a single Flipper.ViewFlipperName.showNext() is used to show the next item in flipper. ViewFlipperName.showPrevious() is used to show the previous item in flipper.

Android ViewFlipper Example:
Xml file looks like
[sourcecode language="xml"]
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
<LinearLayout android:id="@+id/LinearLayout03"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<Button android:id="@+id/Button01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Next"></Button>
<Button android:id="@+id/Button02" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Previous"></Button>
<LinearLayout android:id="@+id/LinearLayout02"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<ViewFlipper android:id="@+id/ViewFlipper01"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<!--adding views to ViewFlipper-->
<TextView android:id="@+id/TextView01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Flipper Content 1"></TextView>
<TextView android:id="@+id/TextView02" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Flipper Content 2"></TextView>
<TextView android:id="@+id/TextView03" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Flipper Content 3"></TextView>
Java file looks like
[sourcecode language="java"]
public class ViewFlipperExample extends Activity implements OnClickListener {
Button next;
Button previous;
ViewFlipper vf;
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
vf = (ViewFlipper) findViewById(;
next = (Button) findViewById(;
previous = (Button) findViewById(;
public void onClick(View v) {
// TODO Auto-generated method stub
if (v == next) {
if (v == previous) {

The output will looks like

Webview is primarily used for loading a html content  in our application.
Let us discuss this in several parts. In this first part let load a normal web page toapplication using webview.
loadUrl is  the prime method to load a particular webpage to webview.
Hence make use of the snippet to load a page.
[sourcecode language="java"]
public class WebViewExample extends Activity {
public void onCreate(Bundle savedInstanceState) {
WebView webView = (WebView) findViewById(;
webView.setWebViewClient(new HelloWebViewClient());
But the above method loads the browser instead of opening the webpage inside the application.
To overcome this difficulty we should use the method shouldOverrideUrlLoading() along with webview and url string.
Now the application opens the web page inside the application itself.
[sourcecode language="java"]
public class HelloWebViewClient extends WebViewClient {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
Layout design
[sourcecode language="xml"]
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="" android:orientation="vertical" android:gravity="center" android:padding="10px">
<TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" - Webview " android:textStyle="bold" android:textSize="20sp" android:textColor="#fff"></TextView><WebView android:id="@+id/webview" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
webview-androidpeople example

Here we are going to see about how to parse a XML using SAX Parser.
we are going to parse XML from net not from local file.

Files Used:- ( Main Activity ) ( Getter & Setter Method ) ( XML Handling )
example.xml ( XML file from net )

The output will looks similar to

[sourcecode language="xml"]



If tag names are different, then we can use string to set & get the value. But here item,name & website tags are repeating 2 times. So we can use ArrayList to store & get the data. This is main activity class. when App. starts this file will be called first. This file contains how to use SAX Parser to handle XML tags.

package com.androidpeople.xml.parsing;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

public class XMLParsingExample extends Activity {
/** Create Object For SiteList Class */

SitesList sitesList = null;
/** Called when the activity is first created. */

public void onCreate(Bundle savedInstanceState) {


/** Create a new layout to display the view */

LinearLayout layout = new LinearLayout(this);

/** Create a new textview array to display the results */

TextView name[];
TextView website[];
TextView category[];

try {

/** Handling XML */
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
/** Send URL to parse XML Tags */
URL sourceUrl = new URL(

/** Create handler to handle XML Tags ( extends DefaultHandler ) */

MyXMLHandler myXMLHandler = new MyXMLHandler();
xr.parse(new InputSource(sourceUrl.openStream()));
} catch (Exception e) {
System.out.println("XML Pasing Excpetion = " + e);

/** Get result from MyXMLHandler SitlesList Object */

sitesList = MyXMLHandler.sitesList;
/** Assign textview array lenght by arraylist size */
name = new TextView[sitesList.getName().size()];
website = new TextView[sitesList.getName().size()];
category = new TextView[sitesList.getName().size()];
/** Set the result text in textview and add it to layout */
for (int i = 0; i < sitesList.getName().size(); i++) {
name[i] = new TextView(this);
name[i].setText("Name = "+sitesList.getName().get(i));
website[i] = new TextView(this);
website[i].setText("Website = "+sitesList.getWebsite().get(i));
category[i] = new TextView(this);
category[i].setText("Website Category = "+sitesList.getCategory().get(i));

/** Set the layout view to display */

} This file is used to handle the XML tags. So we need to extends with DefaultHandler. we need to override startElement, endElement & characters method . startElemnt method called when the tag starts. endElemnt method called when the tag ends characres method to get characters inside tag.
package com.androidpeople.xml.parsing;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class MyXMLHandler extends DefaultHandler {
Boolean currentElement = false;
String currentValue = null;
public static SitesList sitesList = null;
public static SitesList getSitesList() {
return sitesList;
public static void setSitesList(SitesList sitesList) {
MyXMLHandler.sitesList = sitesList;
/** Called when tag starts ( ex:- AndroidPeople
* --  )*/
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
currentElement = true;
if (localName.equals("maintag"))
/** Start */
sitesList = new SitesList();
} else if (localName.equals("website")) {
/** Get attribute value */
String attr = attributes.getValue("category");
/** Called when tag closing ( ex:- AndroidPeople
* --  )*/
public void endElement(String uri, String localName, String qName)
throws SAXException {
currentElement = false;
/** set value */
if (localName.equalsIgnoreCase("name"))
else if (localName.equalsIgnoreCase("website"))
/** Called to get tag characters ( ex:- AndroidPeople
* -- to get AndroidPeople Character ) */
public void characters(char[] ch, int start, int length)
throws SAXException {
if (currentElement) {
currentValue = new String(ch, start, length);
currentElement = false;

Contains Getter & Setter Method

[sourcecode language="java"]
package com.androidpeople.xml.parsing;
import java.util.ArrayList;
/** Contains getter and setter method for varialbles */
public class SitesList {
/** Variables */
private ArrayList name = new ArrayList();
private ArrayList website = new ArrayList();
private ArrayList category = new ArrayList();
/** In Setter method default it will return arraylist
* change that to add */
public ArrayList getName() {
return name;
public void setName(String name) {;
public ArrayList getWebsite() {
return website;
public void setWebsite(String website) {;
public ArrayList getCategory() {
return category;
public void setCategory(String category) {

Now that we have worked with services and notifications separately, we are all ready to use the two together to make a real service that is notified to the user through a status bar update that the service is running. The status bar removes the notification as soon as the service is stopped.

In this program, I also increment a counter once the service starts to show that the service is continuously running in the background while we do other work. When we stop the service we are able to see the updated count.

Let us look at the code:

I have created a class NotifyService which extends the service class. This is the service class that will be started through the activity – ServiceLauncher

Now let us see what the service does?

It does 3 things – Toast a message that the service has started. Update the status bar with a notification. Finally start incrementing the counter. All this is done in the onCreate() method of the NotifyService Class

Toast.makeText(this,"Service created at " + time.getTime(), Toast.LENGTH_LONG).show();

Here is the showNotification() Method:

    private void showNotification() {
 CharSequence text = getText(R.string.service_started);
 Notification notification = new Notification(, text,System.currentTimeMillis());
 PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                new Intent(this, ServiceLauncher.class), 0);
notification.setLatestEventInfo(this, getText(R.string.service_label),
      text, contentIntent);
nm.notify(R.string.service_started, notification);

Finally, here is the method for incrementing the counter incrementCounter():

    private void incrementCounter() {
timer.scheduleAtFixedRate(new TimerTask(){ public void run() {counter++;}}, 0, 1000L);

On stopping the service, it obviously has to do the reverse actions: stop the counter, remove the status bar notification and then toast a message to the end user saying the service has stopped! So here it is:

      Toast.makeText(this"Service destroyed at " + time.getTime() + "; counter is at: " + counter, Toast.LENGTH_LONG).show();

This is the code in the onDestroy() method in the NotifyService class.

With this the service is ready. But we need to be able to start this service and stop it. This I have done through a ServiceLauncher class just as I had done in the previous part of this series. You can get the complete code here.

So far, in all my examples, I have been using the declarative way of creating an Android UI using XML. However, there could arise certain situations when you may have to create UI programmatically. Sincere advice would be to avoid such a design since android has a wonderful architecture where the UI and the program are well separated. However, for those few exceptional cases where we may need too… here is how we do it.
Every single view or viewgroup element has an equivalent java class in the SDK. The structure and naming of the classes and methods is very similar to the XML vocabulary that we are used to so far.
Let us start with a LinearLayout. How would we declare it in an XML?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
This just contains a TextView embedded in a LinearLayout. A very trivial example. But serves the purpose intended. Let me show how almost every single element here corresponds to a class or a method call in the class.  So the equivalent code in the onCreate(…)  method of an activity would be like this:
        lLayout = new LinearLayout(this);
        //-1(LayoutParams.MATCH_PARENT) is fill_parent or match_parent since API level 8
        //-2(LayoutParams.WRAP_CONTENT) is wrap_content
        lLayout.setLayoutParams(new LayoutParams(

        tView = new TextView(this);
        tView.setText("Hello, This is a view created programmatically! " +
                  "You CANNOT change me that easily :-)");
        tView.setLayoutParams(new LayoutParams(

Like this any layout view can be created. But from this small example you can notice two outstanding things – very tedious to code for every attribute of the view. And any simple change in the view, you need to change the code, compile, deploy and only then you see the effect of the change – unlike in a layout editor. 

Your Ad Here

We have seen that we can declare User Interface in Android through XML or we can even create the UI Programmatically. Now, we will see how we can mix the two and use it for building dynamic User Interfaces. One example of such a case would be when on a particular action of the user on one of the UI elements, you need more UI elements to appear on the same screen. How do we achieve this?
You can do it in two ways:
1.       The dynamic part of the UI can be created programmatically. However we saw in my earlier tutorial that it is not a very good way to mix UI and code.  So, we can
2.       Define the dynamic UI too as an XML and use XML inflation to include it into the existing UI.
We will see how to do the 2nd way, which probably is a good practice too.
As always, again a very simple example. Assume I have a very simple linear layout. In that I want to include a button. I can do it as part of the mail XML itself. However, assume that this button is supposed to be reused in many activities and hence I have defined it as a separate XML. How do I include it into the main XML?
So, here is the main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
Here is the buttons.xml that is also created in the res/layout folder:
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android=""
        android:text="Press to close"
And here is the Activity’s onCreate(…) method of the InflateView class:
    public void onCreate(Bundle savedInstanceState) {
        final LayoutInflater  inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        Button b = (Button)inflater.inflate(R.layout.buttons,
        lLayout = (LinearLayout)findViewById(;
First 3 lines must be familiar. In the 4th line, I am getting a handle to the LayoutInflater through the getSystemService(…) method.  This inflater has a method inflate to which I pass the buttons.xml by passing the parameter R.layout.buttons. Then, I try to append this button to the Linear Layout that already exists and is set as the view in line 2 setContentView(R.layout.main). How to append? I get a handle to the LinearLayout lLayout and add the new button to it in the last line!
That simple to inflate an XML and append it to an existing view!
However, I have gone ahead and added another bit to this program as shown below:
        b.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                  //restrict to adding only 1 textview child element
                  if (lLayout.getChildAt(2) == null)
                  TextView tv = (TextView)inflater.inflate(R.layout.text, null);
On the click of this dynamically added button, I am showing how we can add more to the UI dynamically through inflation. Assume, on the click of the button, you want to show some new text. This TextView is defined in another XML called text.xml which is also in the res/layout folder.
So, I am inflating from this XML and appending it to the LinearLayout view. So, a lot can be achieved for dynamic UI through inflation.