Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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 stop testing everything every sprint and only test the code you’ve changed. Brought to you by Parasoft.

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.


Get the top tips for Java developers and best practices to overcome common challenges. Brought to you by Parasoft.

Topics:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}