Issue
Hi? I am working on a MapView app in Android. I have three markers that I want to be able to use the Google Map API getlocation-function on, later on. In order to try it out I would like to move the marker with a drag and drop-function, and then check the location.
Anyone who has gotten a drag and drop to work on an android marker, or know a way to start figuring it out?
/AK
Solution
Here is a sample project from one of my books showing drag-and-drop movement of markers on a Google Map in Android.
In a nutshell, it uses onTouchEvent()
to detect when the user touches and holds their finger near a marker. It then removes the marker from the overlay, but puts the same image over top of the map using RelativeLayout
. Then, on "move" touch events, the image is moved (faster than forcing the whole overlay to redraw). When the finger is lifted, the image is removed, but the marker is put back in the overlay at the new spot.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.