7

I am writing an application for Android platform. The application is already almost written for 2.x version, but I want to make it also for Honeycomb version. As you know, Honeycomb has 'Fragments' rather than 'Activities' for tab target.

There is about 30 activities in my application and it must be changed to fragments. It could be very hard word for me, so I want to know the 'best practice' about doing it.

Thanks.

Programmer Bruce
  • 64,977
  • 7
  • 99
  • 97
  • Hi, did you find a suitable solution? Or is it a case of copying code to a separate code base and manually changing Activities to Fragments? – Dittimon Jul 13 '11 at 05:22

1 Answers1

2

Not really an 100% answer, but just my personal experience so far (and please correct me, anybody, if I got something wrong - I'm still a beginner to Android):

I have the same situation atm and thought I could just re-use my activities and change the layout. E.g. I intended to show my main menu on the left side and all other activities on the right.

However, I soon realized that this isn't really working on Tablet. It just looked crappy and didn't even make sense as the Action bar pretty much replaced my main menu, if used properly. Also, the increased space really screams for a completely different layout. In my app, this will change the user experience completely, so I'll have to re-think the whole app.

On the other hand, stuff that I had to repeat again and again might now be replaced by "invisible" fragments with no UI. I haven't looked closer to this part of the Honeycomb API, but it sounds at least promising.

What I found a nice feature is that you now can "close" your app very easily. In my case I only have one Activity, so a simple "finish" gracefully quits the whole app. I know that this isn't the "Android way" to deal with app life cycle. However, while I don't miss the "close" button on my Android phone (even though some apps, especially games, offer one) I catch myself again and again looking for one on Honeycomb. (That's probably because the GUI reminds one of desktop applications.)

Anyway, long story short: I would recommend re-thinking you app for Tablet. You really have SPACE there, so it just looks strange if you don't use it properly. What this means for your app I don't know - it obviously depends on what kind of app it is. Some activities you'll probably can just use as fragments, some will merge with others, some might become dispensable.

So I guess you should decide first of all if your app really makes sense on Tablets. If not, you could just do the little "optimze" tricks (like applying the holografic theme and maybe new layouts/resources). For everything else I would wait for 4.0/Ice Cream Sandwich, as you will be able to use Fragments on both Smartphone and Tablet then.

jellyfish
  • 7,868
  • 11
  • 37
  • 49