保存 Android MapView 并重新加载
我发现了很多关于保存活动并重新加载它的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我正确理解您的要求,您需要从其他活动返回到您第一次运行的 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.
如果您的意思是保存当前视图,您始终可以保存当前中心点和缩放级别,以便可以将地图重新居中到最后位置。但是,如果您的意思是从 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.