Sunday, April 25, 2010

Book Review: Professional Android 2 Application Development

Professional Android 2 Application Development (Wrox Programmer to Programmer)

Written by an Android authority, this up-to-date resource shows you how to leverage the features of Android 2 to enhance existing products or create innovative new ones.

Serving as a hands-on guide to building mobile apps using Android, the book walks you through a series of sample projects that introduces you to Android's new features and techniques.

It is perhaps one of the most in-depth Android books available, and is also very regularly updated, currently covering Android SDK 2.1 r1.


The Book's author, Reto Meier is a software developer who has been involved in Android since the initial release in 2007. He is an Android Developer Advocate at Google.

Monday, April 19, 2010

Writing Real-Time Games for Android - Google I/O 2009



Do vertex arrays keep you up at night? Do you have nightmares involving frame rates and event loops? If so, this session might have the cure for your condition.

Chris Pruett will discuss the game engine that he developed, using it as a case study to explain the common pitfalls and best practices for building graphics-intensive applications. You'll learn how to properly pipeline game and rendering code, manage drawing surfaces, and incorporate 2D and 3D graphics cleanly.

Tuesday, April 13, 2010

Some notes about Android Context



Context is an interface to global information about an application environment. It's an abstract class whose implementation is provided by the Android system.

Context allows access to application-specific resources and classes, as well as calls for application-level operations such as launching activities, broadcasting and receiving intents, etc.

All the widgets receive a Context parameter in their constructor. In a regular Android application, you usually have two kinds of Context, Activity and Application. It's usually an Activity Context that the developer passes to classes and methods that need a Context.

Basically the Application context is associated with the Application and will always be the same throughout the life cycle of your app, where as the Activity context is associated with the activity and could possible be destroyed many times as the activity is destroyed during screen orientation changes and such.

In particular you should be careful when dealing with anything that deals with the GUI that requires a Context. For example, if you pass the application Context into the LayoutInflator you will get an Exception. It's good practice to use an Activity's Context within that Activity, and the Application Context when passing a context beyond the scope of an Activity to avoid memory leaks.

Here's a quick snippet showing how you can find both the Activity Context and the Application Context:


public class MyActivity extends Activity {
public void aMethod() {
Context actContext = this; /*returns the Activity Context since Activity extends Context.*/

Context appContext = getApplicationContext(); /*returns the context of the single, global Application object of the current process. */

Button btnGoToFirstAct = (Button) findViewById(R.id.btnGoToAct1);
Context vwContext = btnGoToFirstAct.getContext(); /*returns the context of the View. */



When run in the debugger, you can see the results of this:


 Notice that the vwContext in this case also returns the Activity Context.



Hope that helps answer some questions. Drop me a message in the comments if you have anything to add.

Sunday, April 11, 2010

Learn what it takes to make a good Android app great.



Jason, John, and David, mobile industry veterans from Hands-On Mobile, present a technical overview of ways to improve your Android applications stickiness, boost adoption, engage users, and increase monetization and ROI.

This event was hosted by The San Francisco Android User Group at CBS Interactive in San Francisco on August 27th, 2009. The event was sponsored by Hands-On Mobile and organized by Marakana Inc.

Learn how to develop for Android, Beyond HelloWorld



This is a nice, long (2hrs) video, demonstrating many aspects of creating a simple Android application from scratch. Definitely worth checking out if you've got the time.

Sunday, April 4, 2010

How to Make your Android UI Fast and Efficient - video from Google I/O 2009 with Romain Guy


Here a video from Google I/O 2009 with Romain Guy from Google.

"Learn practical tips, techniques and tricks for making your Android applications fast and responsive. This session focussed on optimizations recommended by the Android framework team to make the best use of the UI toolkit."

.. Very interesting stuff. I would really encourage everyone to watch this.
Covers: Adapters, View & Layouts, Backgrounds & images, memory allocation and Drawing & invalidating.