views:

56

answers:

3

Hey everyone. I'm currently developing an app which uses tabs and google map. What I want to do is to get the gps positions, say 3, and store them in sql db (which I'm already doing) and then display them on the map. I already created canvas, added to overlay but those points disappear when I'm changing tabs so I thought if there is a way to somehow store those coords with google map so I can retrieve them and display them nicely whenever I'm clicking the "map tab"? Please can anyone help?

A: 

Use an ItemizedOverlay, and associate the overlay with the map in onCreate(). The overlay should not "disappear when I'm changing tabs".

CommonsWare
+1  A: 

I don't have the answer for you but I know the issue is being caused by the change of view. This is the same as you get when you rotate the device and the screen resets. You need to do something with the onRestoreInstanceState(). The default of this restores the state of your UI. So you need to override it to save the data and readd it when the view changes.

Hope that helps. Someone else might have a code sample.

T

tadywankenobi
A: 

Thanks tadywankenobi! This worked just great - I found a great article on this here. Problem's gone!

Pavel