Jun 18 2012

Why Ice Cream Sandwich Crashes your App

The following question has plagued StackOverflow ever since Ice Cream Sandwich’s initial release:

My application works fine on devices running Android 2.x, but force closes on devices running Honeycomb (3.x) and Ice Cream Sandwich (4.x). Why does this occur?

This is a great question; after all, newer versions of Android are released with the expectation that old apps will remain compatible with new devices. In my experience, there are a couple reasons why this might occur. Most of the time, however, the reason is simple: you are performing a potentially expensive operation on the UI thread.

Jun 14 2012

Ensuring Compatibility with a Utility Class

This post introduces the concept of a utility class and gives a simple example of how you can use one to tidy up your code. As Android projects grow in size, it becomes increasingly important that your code remains organized and well-structured. Providing a utility class for commonly called methods can help tremendously in reducing the complexity of your project, allowing you to structure your code in a readable and easily understandable way.

Jun 13 2012

Designing for Backwards Compatibility

Note: please read this short post before continuing forward.

A common issue in Android development is backwards compatibility. How can we add cool new features from the most recent Android API while still ensuring that it runs correctly on devices running older versions of Android? This post discusses the problem by means of a simple example, and proposes a scalable, well-designed solution.

May 30 2012

Basic Android Debugging with Logs

As with most areas in software engineering, debugging is a crucial aspect of Android development. Properly setting up your application for debugging can save you hours of work and frustration. Unfortunately, in my experience not many beginners learn how to properly make use of the utility classes provided in the Android SDK. Unless you are an experienced developer, it is my personal belief that Android debugging should follow a pattern. This will prove beneficial for a couple reasons:

May 26 2012

Reaping the Benefits of the LoaderManager

With Android 3.0 came the introduction of the LoaderManager class, an abstract class associated with an Activity or Fragment for managing one or more Loader instances. The LoaderManager class is one of my favorite additions to the Android framework for a number of reasons, but mostly because it significantly reduces code complexity and makes your application run a lot smoother. Implementing data loaders with the LoaderManager is simple to implement, and takes care of everything about lifecycle management so are much less error prone.

+1 this blog!

Android Design Patterns is a website for developers who wish to better understand the Android application framework. The tutorials here emphasize proper code design and project maintainability.

Find a typo?

Submit a pull request! The code powering this site is open-source and available on GitHub. Corrections are appreciated and encouraged! Click here for instructions.

Apps by me

Shape Shifter simplifies the creation of AnimatedVectorDrawable path morphing animations. View on GitHub.
2048++ is hands down the cleanest, sleekest, most responsive 2048 app for Android!