Warning: include_once(/home/supaben/public_html/wp-content/plugins/sociable/) [function.include-once]: failed to open stream: No such file or directory in /home/supaben/public_html/wp-settings.php on line 425

Warning: include_once() [function.include]: Failed opening '/home/supaben/public_html/wp-content/plugins/sociable/' for inclusion (include_path='/usr/local/lib/php:.:/usr/lib/php') in /home/supaben/public_html/wp-settings.php on line 425

Warning: Cannot modify header information - headers already sent by (output started at /home/supaben/public_html/wp-settings.php:425) in /home/supaben/public_html/wp-content/plugins/post-star-rating/psr.class.php on line 368
bensangeorge.com » Blog Archive » Android SDK: Separating Presentation and Logic

Android SDK: Separating Presentation and Logic

The Android SDK borrows a lot of it’s UI philosophy from the world of web applications. It attempts to use XML files to give the developer an easier way to manage layout issues. This reduces the “spaghetti code” that gets produced when munging logic with presentation.Imagine the Possibilities!

The file structure of these XML-based layout files are very simple to grasp. Each class that is a descendant of View can be represented as an element within the layout. The attributes that belong to that element determine how much of the properties of that layout element. The XML files are placed within the res/ folder of your project along with any other assets that your application would require such as images, videos, etc.

Using these XML based layouts, development the User Interface becomes easy. So, you get something like:

public void onCreate(Bundle icicle) {

super.onCreate(icicle);
TextView tv = new TextView(this);
tv.setText(”Hello Android”);
setContentView(tv);
setContentView(R.layout.main);

}

Tags: ,

Leave a Reply