3

I'm trying to "port" an iOS app to Android. The original iOS app workflow is:

Tab 1
  List1 -> Detail -> DetailMap

Tab 2
  List2 -> Detail -> DetailMap

Tab 3
  Map -> Detail

Where "List1" and "List2" are lists of places, "Detail" shows info about a place, "DetailMap" shows where the place is on the map. "Map" is a simple map with markers the user can click to reach "Detail".

What's the best way to implement this workflow in Android?

I know I should avoid using a TabActivity (deprecated), and instead use an action bar and fragments to provide navigation tabs. Ok, but then how to implement navigation from "List1" to "Detail", and from "Detail" to "DetailMap"? I don't think it's possible to have fragments inside a fragment?

And what about the maps? I don't think it's possible to have a mapview inside a fragment, right?

I must be missing something (maybe a lot)...

Antonio Giungato
  • 145
  • 1
  • 2
  • 10
  • So basically you want to have a list, when the item in the list is clicked it takes you to details activity, and a button on the details activity takes you to the Detail map? Or tabs activity. YOu could use Action bar too for this. – coder_For_Life22 Dec 19 '11 at 19:47
  • @coder_For_Life22 Could you elaborate a bit please? – Antonio Giungato Dec 19 '11 at 20:01
  • So is List2 in a tab, a a actually list of items? – coder_For_Life22 Dec 19 '11 at 20:01
  • @coder_For_Life22 Yes List2 is a list of items. Let's say List1 is a list of Restaurants, and List2 is a list of Hotels. They are in different tabs in the original iOS app I'm trying to port. – Antonio Giungato Dec 19 '11 at 20:04
  • SO why dont you have a 3 buttons for each list for restaurants, hotels, and what else. And then each button launches a http://developer.android.com/guide/tutorials/views/hello-tabwidget.html with a listview in it and corresponding tabs for lists, details, and mapsview – coder_For_Life22 Dec 19 '11 at 20:10
  • @coder_For_Life22 I'd like to avoid using TabActivity, because it's deprecated. But if there is no other way, I'll live with it. – Antonio Giungato Dec 19 '11 at 20:13

1 Answers1

3

One of the best components for this is the ViewPager. http://tamsler.blogspot.com/2011/10/android-viewpager-and-fragments.html

and

http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html

You can see it in action in the new Android Market, or the Google+ App for Android.

Entreco
  • 12,738
  • 8
  • 75
  • 95
  • Thanks for your reply. Just one thing: are you sure we can use a MapActivity as one of the page in viewpager? – Antonio Giungato Dec 20 '11 at 13:41
  • I'm not 100% sure -> haven't tried it. But this question: http://stackoverflow.com/questions/5109336/mapview-in-a-fragment-honeycomb looks promising. Good luck – Entreco Dec 20 '11 at 14:22
  • Btw, I have succesfully implemented a ViewPager using Fragment, and a Map... It required some severe googling, but there are nice solutions – Entreco Jun 15 '12 at 06:49