如何从 Overlay onTap 方法将按下的位置返回到 MapActivity
我有一个活动,有一个按钮,可以打开一个新的 MapActivity,通过点击地图来选择位置。
地图有一个覆盖层,它覆盖 onTap 方法来获取位置,但我想将该位置返回到上一个活动,但是,我不知道如何将地理点返回到地图活动以便调用 setResult() 并完成() 方法,因为我无法从 Overlay.onTap 方法中调用它们。
有什么想法吗?
I have an activity that has a button which opens a new MapActivity to select a location by tapping on the map.
The map has an overlay that overrides the onTap method to get the location but I want to return that location to the previous activity but, I don't know how to return the geopoint to the mapactivity in order to call the setResult() and finish() methods, because I can't call them from the Overlay.onTap method.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是这样解决的:
Solved this way:
使用意图调用新活动...
然后,使用 onActivityResult( int , int , Intent) 从当前活动调用新活动.....
当您完成被调用的活动时,您应该从新活动取回数据,因为调用活动被放置在堆栈上...
希望这有帮助...:)
Call the new activity using an intent ...
Then , Use onActivityResult( int , int , Intent) to call the new activity from the current activity.....
U should get back the data from the new activity when u finish the called activity as the calling activity is placed on the stack ...
Hope this helps ... :)