保存地图状态的Andr​​oid谷歌地图V2 [英] Saving the map state in android google maps v2

查看:141
本文介绍了保存地图状态的Andr​​oid谷歌地图V2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序我有一个加载了地图标记,然后我可以在某些点上手动添加标记到地图中。现在的问题是我如何保存这些手动添加标记,以便当用户退出应用程序或浏览到一个不同的活动,然后返回到地图中,然后标记应该仍然在那里。

In my app i have markers that load up with the map and then i can add markers manually to the map at certain points. Now my question is how can i save those manually added markers so when the users exits the app or navigate to a different activity and then returning to the map, then the markers should still be there.

我已经尝试给出了几个例子,但似乎并没有工作,只为当屏幕旋转,而不是退出应用程序,并返回。

I have tried a few examples given but that doesn't seem to work, only for when the screen rotates, but not for exiting the app and returning.

可能有人请点我朝着正确的方向有一个例子,我可以遵循?
真的AP preciate吧。

Could some one please point me in the right direction with an example i can follow?
Would really appreciate it.

感谢。

推荐答案

您正好有存储标记的经度和纬度的地方离线/在线,这样,下一次当一次你的应用程序被打开,你的应用程序fethces标记的位置,你可以添加标记再次向地图。

You just to have the marker latitude and longitude stored somewhere offline/online so that when next time your app gets opened, your app fethces markers locations and you can add marker again to the map.

对于在线存储数据,你只需要发送信息到服务器,并把它抓回来,当应用程序被再次启动。

For storing data online, you just need to send information to server and fetch it back, whenever app is started again.

有关离线存储,看看从Android开发人员培训: HTTP ://developer.android.com/training/basics/data-storage/index.html

For offline storage, have a look at training from android developers : http://developer.android.com/training/basics/data-storage/index.html

希望这有助于..

这篇关于保存地图状态的Andr​​oid谷歌地图V2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆