The Many Flavors of Commit()

FragmentTransaction in the support library now provides four different ways to commit a transaction:

  • commit()
  • commitAllowingStateLoss()
  • commitNow()
  • commitNowAllowingStateLoss()

You have probably also encountered one of these alongside a call to executePendingTransactions(). What do each of these do, and which one should you be using? Let’s explore each one in more depth and find out!

Read on Medium ›

Managing the Fragment Back Stack

Or: A lesson in not fighting the framework

The Android framework provides simple APIs for managing your back stack without headache for most simple applications. However at some point you are likely going to run into a situation that doesn’t quite fit the mold of a an application with a simple back stack.

Learn about some of the Fragment APIs you aren’t familiar with for some strategies on how to better work with the framework.

Read on Medium ›

Android Barcode Scanning Library Landscape

There are a few different barcode scanning libraries out there right now and I will provide an overview of the three most popular options out there right now- ZXing, ZBar, and Google’s Mobile Vision API. This is a qualitative look at these libraries, so I won’t attempt to provide benchmarks.

What we have found is that there isn’t a single clear winner right now. Each library has at least one major drawback. Selecting a library for your project requires knowing the relative strengths and weakness of these libraries so you can pick the one that best fits your use case.

Read on Medium ›

Fragment Transitions with Shared Elements

One of the cornerstones of Material design is meaningful motion between screens. Lollipop introduced support for these animations in the form of the transitions framework, which allows us to animate transitions between Activities and Fragments. I haven’t seen many articles on how to use transitions with Fragments, so I set out to write one!

Read on Medium ›

Quick Return with CoordinatorLayout

One nifty UI element that you can add to a scrolling view is a quick return view- an element that disappears when the user scrolls in one direction, then reappears when the user scrolls in the opposite direction.

Learn how to leverage CoordinatorLayout to implement a quick return element!

Read on Medium ›