Over a million developers have joined DZone.

Flow and Mortar: Libraries to Simplify Android Activities and Fragments

DZone's Guide to

Flow and Mortar: Libraries to Simplify Android Activities and Fragments

· Java Zone
Free Resource

Learn how to troubleshoot and diagnose some of the most common performance issues in Java today. Brought to you in partnership with AppDynamics.

We recently heard about Square's Flow as a solution for Android-induced development headaches, and it's a pretty interesting tool that looks like it could do a lot to speed up some of the uglier parts of Android development. Flow is a library that helps Android developers keep track of what view an app should be showing using view instances, and aims to simplify some of the confusion that came with Android's Activities and Fragments. According to the Square's overview:

[Flow] is a backstack model that knows you likely have to deal both with the device's back button as well as an ActionBar's up button. The things that Flow manages are referred to as "screens," with a lowercase "S" — they're not instances of any particular class. To Flow a screen is a POJO that describes a particular location in your app. Think of it as a URL, or an informal Intent.

Along with Flow, Square has built a library called Mortar that determines what happens when Flow takes you to a new view. 

To see how it all works, Square's overview also includes a walkthrough of building a music player app with album and track screens, complete with explanations of the roles of Flow and Mortar, as well as code samples of implementation.

Understand the needs and benefits around implementing the right monitoring solution for a growing containerized market. Brought to you in partnership with AppDynamics.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}