保存 Android MapView 并重新加载

发布于 2024-09-10 08:04:49 字数 128 浏览 1 评论 0原文

我发现了很多关于保存活动并重新加载它的 stackoverflow 帖子。 我的问题:如何拥有带有 MapView 的 Activity 并在重新加载相同的 mapview 后? 在活动和视图之间切换的最佳方式是什么? 谢谢:卡罗利

I had found a lot of stackoverflow post about save an Activity and the reload it.
My question: How can I have an Activity with an MapView and after reload the same mapview ?
What is the best way to switch between activity and views ?
Thanks:Karoly

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一身仙ぐ女味 2024-09-17 08:04:49

如果我正确理解您的要求,您需要从其他活动返回到您第一次运行的 MapActivity 的同一个实例。

为此,从您的其他活动中,只需使用带有标志 FLAG_ACTIVITY_REORDER_TO_FRONT。这不会创建您的 MapActivity 的不同实例,而是将您的第一个实例置于前面。

If I understand correctly what you ask, you need to come back from your other activities to the same instance of MapActivity that you first have run.

In order to do that, from your other activity, just start the MapActivity with an Intent with the flag FLAG_ACTIVITY_REORDER_TO_FRONT. This will not create a different instance of your MapActivity but bring to front your initial one.

孤千羽 2024-09-17 08:04:49

如果您的意思是保存当前视图,您始终可以保存当前中心点和缩放级别,以便可以将地图重新​​居中到最后位置。但是,如果您的意思是从 MapActivity 转到新的 Activity 然后再返回,则视图应该仍然相同。

If you mean save the current view you can always save the current center point and zoomlevel so you that you can re-center the map to the last position. But if you mean just going from your MapActivity to a new Activity and coming back, the view should still be the same.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文