Friday, June 29, 2012

[android-developers] Passing information between two Fragments (Map Fragment and List Fragment)

I am looking for the best way to send information between a Map Fragment and a List Fragment.  Half the screen is dedicated to a Map Fragment using the TabHost method, while the other half is dedicated to a List Fragment.  The main activity creates the separate fragments which each have their own Fragment and Activity classes.  My desire is to send an ArrayList of waypoints created in my ItemizedOverlay class that is within the Map Fragment to the List Fragment which will in turn display each waypoint.  From the List Fragment side, I desire to send the selected List item (waypoint) back to the Map Fragment so I can then display a bubble giving information on that waypoint.  More will be done, but this is one part of my problem.

I am sorry if familiar questions to this have been asked, but I have not found one that details how to dig deep into a class such as ItemizedOverlay and pass the information back and forth.  Some methods I have seen are Intents and direct passing a pulling variables in each Fragment, but I am unsure of the best way to handle this information sharing.  I have even looked into the possibility of keeping a third fragment in the background as I will at one time be sending these waypoints outside of this app to another phone.

Any help would be appreciated and I would be happy to give more information if needed.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment