Category Archives: Opensource

Fly is now Open Source

It’s a known fact that ninjas like open source.

There are many good reasons for releasing your source code into the open, but in the end we do it because it feels right.

The Fly app was originally hacked up over a weekend in late 2010, but has been polished a bit since then (although there are still some rough edges here and there). The Qt version has been published in Ovi Store (both for Symbian and MeeGo) and Google Play (experimental) and we’ve had some pretty good download numbers, for a local app.

Fly on the Nokia E7

That’s not to say that it’s anywhere near perfect. There are lots of improvements that can be made. If you feel like improving it, the sky is the limit! (pun intended ;) ).

It has been a long time coming, but we have finally released the Fly source code as open source. You can clone the github repository here or browse the source code here. Happy hacking!

Tabs on Android

Using a tabbar, either at the top or bottom of an interface, is a typical design pattern used in apps to navigate between segments. This is used by the Android Twitter client for example. The typical way to implement this is by using TabWidget, TabActivity, TabHost and friends. Each tab is populated with whatever activity you want and all is well.

There is a problem with this approach however. If you start a new activity the tabs (area A, B, C) all disappear and this is not always what you want. Sometimes what you want is to keep the tabbar around and have an individual backstack for each of the tabs.

Typical tab layout

Typical tab layout

I’ve published an example on github that shows how you can get the best of both worlds. It explains how to keep an individual backstack for each tab, but also how to start activities that break out of the tabs as is the traditional way on Android. The Back button still works and you can also programmatically navigate back. The behavior of back is changed to respect the backstack of each individual tab.

If you want to try it out yourself I’ve compiled an Android package for you. Navigate to http://bit.ly/stacksintabs with your Android device and install the .apk to check it out.

Navigation in the example

Navigation in the example

The design is very simple. I still use TabWidget, TabHost and TabActivity (layout here) – but instead using normal activities for each tab, I subclass FragmentActivity – and build a stack of Fragments inside each tab. The gist of the code is in the addFragment(…) function

To launch a new fragment inside a tab (area D), see the launchNewFragment() function, and to see how you break out of the tabs and launch a new activity (area E) see the function launchNewActivity(…)

The fragments and activity I use are just examples, the point is that you replace ExampleActivity and ExampleFragment with you own classes.

My initial approach at solving this problem was using Fragments exclusively, but since nested Fragments are not supported on Android I gave up.

I hope this helps some of you – it’s all available under a BSD license. The example requires API level 7 and uses the Android Support library v4. Comments and contributions are welcome. Btw: I’m also working on a comparison between QML and Android XML where I compare pros and cons, so stay tuned for more :)