Android Development Ready


I bought Google Nexus 4 last month and convinced 2 other female friends to buy the same model. All of us are happy about what we got. I was fascinated with the smoothness of the user interaction and elegance of the user interface. It’s priced at half of iPhone 5’s retail price with a quarter larger display. No wonder Apple’s stock tanked.

Then as a software development professional, I questioned myself: what’s the cost of developing apps on the phone. For most Android owners with a working PC, it’s none. For businesses, it’s about a price of a phone and a PC. To do the same on iPhone or iOS, the price is double as Apple tends to double the prices of its products with virtually equivalent features as mainstream competitors. Google has made great tutorial and sample apps for even non software professional to easily get started with Android development.

One of the interesting problem I discovered about Android API is:
** Java does not have method delegates. It’s been a known issue since .NET introduced delegate in 2003.All the Activity state transitions are done in OnCreate, OnStart, OnResume, OnPause, OnStop, OnDestroy. All the child classes are supposed to implement or override those state transitioning callback methods. A senior Android developer friend informed me of such issue when he tried to develop library kind of Java code for his activities. He said it is cumbersome to have to write library’s routine methods (initialize, close, finalize, etc…) in each On[State] callback method. I proposed a solution of using a controller to handle the mapping between activity’s state transitioning and the library's ought-to-do routines (similar to the MVC pattern). It's not a perfect solution but does solve part of the problem. I think the root cause is that developers can't hook the code into the Activity base class for handing custom library's routines. In C#, this could have been done by assigning delegates to the state transitioning events in the Activity class. When the activity's state changes, the event triggers the assigned delegates and therefore invokes the routine methods of the custom built library.

Tutorial sample app's image included here. Code has been changed to show a buzzard activity state.

activity.png


Skip to main content