如何使用带有 ADT 的 Eclipse 为带有谷歌地图的 android 创建地理标记图像/位置标记应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26902555/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create GeoTagging image / location tagging application for android with google maps using eclipse with ADT
提问by James
Hello my name is James,
你好,我叫詹姆斯,
I am self-learning how to develop android applications, I have designed few basic apps – to name a few calculator app, notepad, percentage calculator for android. After developing few small basic apps, I am planning on making more advance apps, I am planning on creating an app that allows the user to tag their location on google map or geotag images using the application, which will only be visible to them. For example, the user can tag location to a map and later on get directions to that location or take an image of a location and geotag it to the map and add some sort of description to it.
我正在自学如何开发 android 应用程序,我设计了一些基本的应用程序——举几个计算器应用程序,记事本,android 的百分比计算器。在开发了几个小型的基本应用程序之后,我计划制作更高级的应用程序,我计划创建一个应用程序,允许用户使用该应用程序在谷歌地图或地理标记图像上标记他们的位置,这些应用程序只对他们可见。例如,用户可以在地图上标记位置,然后获取到该位置的路线或拍摄位置图像并将其地理标记到地图上并为其添加某种描述。
I have been searching on google for some time now, on how I can go about designing this app but I haven't really found any tutorial / guides how to implement the image geotagging / location tagging to google map.
我已经在谷歌上搜索了一段时间,关于如何设计这个应用程序,但我还没有真正找到任何教程/指南如何实现图像地理标记/位置标记到谷歌地图。
Please can someone give me some guide, something to read upon or maybe correct me if am not searching for the right materials.
如果我没有寻找正确的材料,请有人给我一些指南,一些可以阅读的东西,或者可以纠正我。
So far, I have carried out searches including: How to add google maps to my android application (I found a good guide for this and I understand how I can do this) How to implement geotagging on your android application (Haven't found any useful material apart from few applications released on play store) How to implement location tagging (Haven't found any useful material for this either) I found a video on YouTube where the person has designed a similar app that I am planning on doing http://www.youtube.com/watch?v=_V49bXXtnvUbut other than I have only come across videos / guides that shows how to add google maps to your android application something like http://www.youtube.com/watch?v=awX5T-EwLPc
到目前为止,我已经进行了搜索,包括:如何将 google 地图添加到我的 android 应用程序(我找到了一个很好的指南,我了解如何做到这一点)如何在你的 android 应用程序上实现地理标记(还没有找到任何有用的材料,除了在 Play 商店发布的少数应用程序之外)如何实现位置标记(也没有找到任何有用的材料)我在 YouTube 上找到了一个视频,其中有人设计了一个类似的应用程序,我打算做http: //www.youtube.com/watch?v=_V49bXXtnvU但除此之外,我只遇到过视频/指南,这些视频/指南展示了如何将谷歌地图添加到您的 android 应用程序中,例如http://www.youtube.com/watch?v =awX5T-EwLPc
Thanks for your time.
谢谢你的时间。
回答by Dark Matters
I'm not sure if you found your answers already, but in case you or someone else is still looking: - http://www.vogella.com/tutorials/AndroidGoogleMaps/article.html
我不确定您是否已经找到答案,但万一您或其他人仍在寻找: - http://www.vogella.com/tutorials/AndroidGoogleMaps/article.html
I found that tutorial helpful in getting started with MapsActivity
. If you are using Android Studio then just start a new project with the main activity selected as Map activity. This will start you off with a lot of the necessary code for starting the Google Maps API. It will walk you through how to get your google api key for your app.
Once you have that set up, then look at the several listeners that are available for the map. Some that you may want are Map.setOnMapLongClickListener
, Map.setOnMarkerClickListener
, Map.setOnMarkerDragListener
. These will help you decide what to do with locations on the map.
Look at the Marker
class to be used Google Map. You will set your tags/markers with this class. You can replace the default marker with your image if you like or create your own custom tag. https://developers.google.com/android/reference/com/google/android/gms/maps/model/Marker?hl=en
我发现该教程有助于开始使用MapsActivity
. 如果您使用的是 Android Studio,则只需启动一个新项目,并将主要活动选为 Map 活动。这将为您提供许多启动 Google Maps API 所需的代码。它将引导您了解如何为您的应用获取 google api 密钥。
完成设置后,请查看可用于地图的几个侦听器。您可能想要的一些是Map.setOnMapLongClickListener
, Map.setOnMarkerClickListener
, Map.setOnMarkerDragListener
。这些将帮助您决定如何处理地图上的位置。
看一下Marker
要使用谷歌地图的类。您将使用此类设置标签/标记。如果您喜欢或创建自己的自定义标签,您可以用您的图像替换默认标记。 https://developers.google.com/android/reference/com/google/android/gms/maps/model/Marker?hl=en
You can use LocationManager
to get your current location. Here is a simple tutorial: http://javapapers.com/android/get-current-location-in-android/
您可以使用LocationManager
来获取您当前的位置。这是一个简单的教程:http: //javapapers.com/android/get-current-location-in-android/
If you plan on providing Camera within your app or get images from gallery, you should review the Camera Class : http://developer.android.com/guide/topics/media/camera.html
如果您计划在您的应用程序中提供相机或从图库中获取图像,您应该查看相机类:http: //developer.android.com/guide/topics/media/camera.html
and a simple tutorial: http://www.tutorialspoint.com/android/android_camera.htm
和一个简单的教程:http: //www.tutorialspoint.com/android/android_camera.htm
I would add one feature at a time when starting your app project. Create the map with working key and make sure it displays a map. Then, add a marker on your current location (on an emulator, you will have to set the default location because it will not have gps). Then, allow the user to add a marker by i.e long pressing on a map location. Then, open a dialog box of choices when long pressing on map, i.e tag location, tag with custom tag, tag with camera image, etc.
在启动您的应用程序项目时,我会一次添加一项功能。使用工作键创建地图并确保它显示地图。然后,在您当前的位置添加一个标记(在模拟器上,您必须设置默认位置,因为它没有 gps)。然后,允许用户通过长按地图位置来添加标记。然后,在地图上长按时打开一个选择对话框,即标签位置、自定义标签标签、相机图像标签等。