Dec 15 2014

Content Transitions In-Depth (part 2)

A content transition determines how the non-shared views—called transitioning views—enter or exit the scene during an Activity or Fragment transition. Motivated by Google's new Material Design language, content transitions allow us to coordinate the entrance and exit of each Activity/Fragment's views, making the act of switching between screens smooth and effortless. Beginning with Android Lollipop, content transitions can be set programatically by calling the following Window and Fragment methods:

  • setExitTransition() - A's exit transition animates transitioning views out of the scene when A starts B.
  • setEnterTransition() - B's enter transition animates transitioning views into the scene when A starts B.
  • setReturnTransition() - B's return transition animates transitioning views out of the scene when B returns to A.
  • setReenterTransition() - A's reenter transition animates transitioning views into the scene when B returns to A.
Dec 4 2014

Getting Started with Activity & Fragment Transitions (part 1)

Activity and Fragment transitions in Lollipop are built on top of a relatively new feature in Android called Transitions. Introduced in KitKat, the transition framework provides a convenient API for animating between different UI states in an application. The framework is built around two key concepts: scenes and transitions. A scene defines a given state of an application's UI, whereas a transition defines the animated change between two scenes.

When a scene changes, a Transition has two main responsibilities:

  1. Capture the state of each view in both the start and end scenes, and
  2. Create an Animator based on the differences that will animate the views from one scene to the other.
Jan 13 2014

Thread Scheduling in Android

This post will give an overview of how thread scheduling works in Android, and will briefly demonstrate how to explicitly set thread priorities yourself to ensure that your application remains responsive even as multiple threads run in the background.

For those who are unfamiliar with the term, a thread scheduler is the part of the operating system in charge of deciding which threads in the system should run, when, and for how long. Android's thread scheduler uses two main factors to determine how threads are scheduled across the entire system: nice values and cgroups.

Jan 8 2014

Redesigning Android Design Patterns

A couple weeks ago, I began the ambitious task of rewriting this blog from scratch. Today, I'm happy to introduce a brand new look: one that is cleaner, faster, and more responsive.

Several of the major changes are listed below. If this is your first time visiting this blog, you can find the old version of the site here to use as a reference.

Aug 20 2013

Fragment Transactions & Activity State Loss

The following stack trace and exception message has plagued StackOverflow ever since Honeycomb's initial release:

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

This post will explain why and when this exception is thrown, and will conclude with several suggestions that will help ensure it never crashes your application again.

+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

2048++ is hands down the cleanest, sleekest, most responsive 2048 app for Android! [Play Store]