i have successfully followed this tutorial:
http://mobiforge.com/developing/story/using-google-maps-android
basically, it creates a map and adds an overlay item and returns the
address after a user presses the map. i want to be able to add
another overlay item/marker when the user presses the map. i am
having trouble figuring out where to do this. i have tried recreating
the code that adds the initial marker - but i keep getting errors. i
am not sure if it belongs in the onTouchEvent function, or if it
belongs out of the overlay class entirely. here is the draw function:
@Override
public boolean draw(Canvas canvas, MapView mapView,
boolean shadow, long when)
{
super.draw(canvas, mapView, shadow);
//---translate the GeoPoint to screen pixels---
Point screenPts = new Point();
mapView.getProjection().toPixels(p, screenPts);
//---add the marker---
Bitmap bmp = BitmapFactory.decodeResource(
getResources(), R.drawable.icon);
canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50,
null);
return true;
}
the first overlay item has the geopoints defined outside of the
overlay class, so maybe i need to somehow pass the geopoints when the
user touches the map back to the map activity? i am not sure how to
do that yet. any help is appreciated. if i find a solution i will
post it. thank you!!!
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en