PMG Digital Made for Humans

iPhone Developers, Meet Android – Part III : Stop the Infinite loop!

3 MINUTE READ | October 21, 2011

iPhone Developers, Meet Android – Part III : Stop the Infinite loop!

Author's headshot


PMG is a global independent digital company that seeks to inspire people and brands that anything is possible. Driven by shared success, PMG uses business strategy and transformation, creative, media, and insights, along with our proprietary marketing intelligence platform Alli, to deliver Digital Made for Humans™. With offices in New York, London, Dallas/Fort Worth, Austin, Atlanta, and Cleveland, our team is made up of over 900+ employees globally, and our work for brands like Apple, Nike, Best Western Hotels & Resorts, Gap Inc., Kohler, Momentive, Sephora, and Shake Shack has received top industry recognitions including Cannes Lions and Adweek Media Plan of the Year.

Now, this is something I have seen done way too many times, mostly in applications that are obvious ports of their iPhone counterparts. This is the kind of thing where you can literally create an infinite number of new activities in your application because two activities are capable of calling each other. I’ve mainly seen this done in apps that are trying to implement a Tab Bar like UI element. As I stated before, this really does not work, not in the same way that it works on the iPhone. The problem is with the iPhone you have this nice clean container, called the Tab Bar Controller that holds all of the views displayed by it, it and only it handles their lifetime. You don’t get something like that in Android without building it yourself from scratch. If you think of it, as Android is meant to be developed, then each Activity has its own view. So, what most people end up with, when trying to implement a Tab Bar, is to create a separate Activity for each Tab/view of the Tab Bar, each with the capability of calling all of the activities in the Tab Bar. The problem with this is, you end up with two or more activities capable of calling one another.

Think of it like this, every Activity has a specific purpose, a specific action that it is meant to perform, the only time you should call a new activity is if you want to take what you have already done and perform further actions with it. A Tab Bar is a collection of multiple, different, completely separate actions; they don’t need each other, so why should they call one another into existence. Every new activity is meant to perform an action and then return to the previous activity.  Therefore any time you create a set of Activities capable of calling one another, you’re actually breaking out of the architectural patterns of the android platform, a risky thing to do on any platform.  In the end, all you really get from your endeavor is a never-ending tree.

From the Home Tab you can call an intent for either the Find Tab or the Account Tab creating an entirely new activity upon selection.  Then, from the Find Tab you can reselect the Home Tab or proceed on to the Account Tab, both options create an entirely new activity that is completely unaware of the previous Activities’ existences.  As a user you could actually go back and forth between any two tabs countless times, creating a seemingly unending path of activities once you try to start going back through the application.  This horrible infinite loop/never-ending tree can be created in many other ways than just attempting to implement Tab Bar like functionality. So, avoid it all costs. Not only will this save you from a lot of memory issues, but it will also make your app feel a lot more congruent.

Stay in touch

Bringing news to you

Subscribe to our newsletter

By clicking and subscribing, you agree to our Terms of Service and Privacy Policy

I realize this has been a fairly short part to this series, but I’ve seen this done far too many times to let it be a side point to another part. So, if you want a great way to make sure that your users delete your application from their device and write you a hate-filled review, make sure you have a nice, ugly infinite loop to trap your users in.  If not, please, test your apps forward and backward. Ensure that it is entirely impossible for your application to find itself in this lovely infinite loop.

Related Content

thumbnail image

AlliPMG CultureCampaigns & Client WorkCompany NewsDigital MarketingData & Technology

PMG Innovation Challenge Inspires New Alli Technology Solutions

4 MINUTES READ | November 2, 2021

thumbnail image

Applying Function Options to Domain Entities in Go

11 MINUTES READ | October 21, 2019

thumbnail image

My Experience Teaching Through Jupyter Notebooks

4 MINUTES READ | September 21, 2019

thumbnail image

Working with an Automation Mindset

5 MINUTES READ | August 22, 2019

thumbnail image

3 Tips for Showing Value in the Tech You Build

5 MINUTES READ | April 24, 2019

thumbnail image

Testing React

13 MINUTES READ | March 12, 2019

thumbnail image

A Beginner’s Experience with Terraform

4 MINUTES READ | December 20, 2018