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.

Transient

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.

stacksintabs-navigation.png

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 :)

Cutehacks 1st year - An executive summary

Time flies when you're having fun, and we've had lots! It's been year since we started Cutehacks. Here is a short summary of what we've achieved, and what we've learned - the good stuff and the bad stuff. For the executive brief, check out the video below.

 

Achievements

  • Formed a legal company
  • Got an office and bought hardware
  • Got an accountant, lawyer, designer etc.
  • Published 4 Symbian apps
    • Yr.no for NRK
    • Telenor Faktura for Telenor
    • WiMP for Aspiro
    • Fly for ourselves :)
    • Made our Symbian apps run on Maemo, MeeGo and Android as well
    • Contributed a bit to Qt for Android
    • Created a UI prototype on Win/Mac/Symbian for a client
    • Went to Qt Developer Days, Qt Contributor Summit, MeeGo Summit, Akademy, SEE, etc.
    • Consulted for ad-agencies and printing companies
    • Stayed at five star hotels - for FREEEEE
    • Got 3 minutes on national TV
    • Got mentioned on lots of mobile sites
    • Started a tech-startup-network-club-thingy
    • Got tattooed
    • Got paid

Three things we've learned

"If you set yourself goals, you will actually reach them": When we started Cutehacks we said that an ideal project for us would be to develop the WiMP client. One year later, we actually achieved that. We've also worked towards getting our apps running across multiple platforms - this is also starting to happen.

"Ask and you may receive": We've gotten free hardware, new projects and invitations to talks - simply by asking for it.

"The only constant is change": Wow, this one has definitely been true for us. We didn't see 2/11 coming - but once it did, we've simply had to adjust and move on.

Some advice for software startups

  • Use LinkedIn
  • Use Twitter
  • Use YouTube
  • Use Google Apps (Mail, Documents, Calendar)
  • Use Github (or similar)
  • Use Wordpress (or similar)
  • Use a professional accountant
  • Use a professional designer
  • Present at conferences
  • Say Yes more than No
  • Build up your IP
  • Act professional
  • Use your network
  • Ask for things
  • Get an office
  • Always look for new projects
  • Experiment with new technology
  • Get signed contracts
  • Always go to a meeting prepared
  • KISS
  • Do it
Share

Cross platform apps at MWC

Three of our apps are being shown at the Mobile World Congress this year, for several different devices. If you want to have a look at them in real life head over to the Qt booth located here. The video below shows our apps running on a few of the many platforms supported by Qt.

As you may know, Qt has been a cross-platform toolkit from day one, and supports many more mobile platforms than just Symbian and MeeGo. Here is a list of some of the different mobile platforms Qt runs on today:

Mobile OS

Support

Links

Android

Community

Video

iOS

Community

Video

Windows Mobile

Official

Video

webOS

Community

Article

QNX (Blackberry Playbook)

Community

Video

Symbian

Official

Video

Maemo/MeeGo

Official

Video

...and there have been reports on success getting it running for Bada and Amazon Kindle as well. Go to the Qt booth to see more apps running across both desktop and mobile platforms.

Share