Thursday, 5 January 2012

First View of Android app structure behind the Scenes

Well I thought XAML and c# could be complicated, but the pattern that holds the Android UI together is no simple walk through the park either. And having not looked at Java in years, I presume it is similar for other Google Apps? Cryptic is not the word. The basis for the elements to be rendered is fair enough. It's XML and I like the render tool that is built into the the eclipse plugin for Android. But the model for linking it to the Java code behind the form is not intuitive and requires you to burrow down through resources to see how it all comes together and all this from a resource reference in the default Activity stub called R??

We go from this

public class Project1Activity extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {

which is fair enough to this which is the equivalent of .g.s.cs hidden code generated file in VS

package com.appsolo.adnroid;

public final class R {
public static final class attr {
public static final class drawable {
public static final int ic_launcher=0x7f020000;
public static final class layout {
public static final int main=0x7f030000;
public static final class string {
public static final int app_name=0x7f040001;
public static final int hello=0x7f040000;

which is not

and then we are down to the resources which I know XAML can rely heavily on as well

here is the XML for the form which is rendered in the tool

xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=""



android:orientation="vertical" >




android:text="@string/hello" />


The XML is rendered nicely in the Graphical Tool of the Android plugin

Although there is a Android Resources values tool for keeping track of values

But there are a lot of Dots to join up here!!!

No comments:

Post a Comment