Introduction to Android 2 application development
Written by Sing Li   
Wednesday, 25 August 2010
Article Index
Introduction to Android 2 application development
iProgrammer example
A practical Activity
Compatability
Ready to run
Using the Eclipse ADT

Banner

 

Load up the sample code (download ) in Eclipse and give it a try for yourself. The Eclipse plugin make this as easy as right clicking your Android project, and select Run As .... Android Application. In a little while, Eclipse will automatically start up the Android AVD, download your application to it, and then start it.

Figure 3 shows the Android AVD running - the green and white icon at the top right is the example i-Programmer application.

 

figure3

Figure 3

When you run this i-Programmer application, a button is displayed at the bottom of the Android screen - as shown in Figure 4. The button is labeled "Vote i-Programmer.info".

 

figure4

Figure 4

 

If you touch/click the button, a large "Thank you!" message is displayed - as shown in Figure 5. While simple in construction, it is a fully-fledged Android App that displays a user interface and responds to user input.

 

figure5

Figure 5

Let us see how this application is constructed. But first, a brief word on the philosophy behind Android application development.

Hooking for Fun and Profit

Get used to it! You are not in control.

Unlike application writing for desktop systems, modern Smart Phone OSs will not give you control. It is the same with Android, iOS, Symbian, Blackberry, bada, and so on. And this is all "for your own good", according to the manufacturers.

Instead of taking direct control, you must "hook".

Before you don your best looking outfit and put on your favorite dancing shoes to get ready for a night in the town, stop! Cool off by examining Figure 6

.figure6

Figure 6 (Click to enlarge)

Clicking on Figure 6, you can clearly see that the mobile OS platform, such as Android, is highly protective and security conscious with functions that are important to phone users such as:

  • Data Integrity and Security
  • Network Usage and Accounting
  • CPU usage and Process Control
  • Isolation between Different Application
  • Location (GPS) Information Protection and Management
  • Battery life management
  • Application installation/removal and Management

In order for the Android platform to effectively carry out the above duties (or In the name of homeland security), it owns the main() method and the core event handling loop of every application and you have no direct access to it.

Instead, you must hook into this chain of control by writing at least one Activity. An Activity is Andorid's polite way of saying "don't call me, hun - I'll call you when I am ready".

 

Banner

<ASIN:0071748725>

<ASIN:0596521472>

<ASIN:1449390501>

<ASIN:1430230002>

<ASIN:1430232765>

<ASIN:047077018X>

<ASIN:0470903198>



Last Updated ( Sunday, 19 September 2010 )
 
 

   
RSS feed of all content
I Programmer - full contents
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.