I'm relatively new to java and android programming, and i wanted to get coordinates based on a point that i tapped on HERE maps. I really hoped you guys could help me out with this.
Edit :
This is the code that i tried to implement, however, it returned me with the error :
Error:(354, 53) error: cannot find symbol variable PointF :
private void addDestination() {
image.setImageResource(R.drawable.marker);
GeoCoordinate endpoint = map.pixelToGeo(PointF);
MapMarker destination = new MapMarker(endpoint,image);
if (destination != null)
{
map.removeMapObject(destination);
}
else
{
map.addMapObject(destination);
}
}
PointF is a datatype, so calling "map.pixelToGeo(PointF)" doesn't make sense, you need to call it with concrete data.
In a short: You need to listen for click events (or longpress, or whatever event you wanna handle), and you get PointF data that's reflecting the screen coordinates. Then you can convert the screen coordinates via pixelToGeo into geocoordinates that you can use to add mapmarker or whatever you wanna do with it on the map.
Some code to help you getting started:
Listening to click events on the map (to retrieve the PointF screencoordinates) are done via registering the gestureListener to your mapview. Means, after successfull mapengine init, you do something like that:
yourMapViewInstance.getMapGesture().addOnGestureListener(yourGestureHandlerImpementation, 10, true);
and in your gestureHandler implementation, you can override several events (click, longpress, etc.), so for example you can do for longpress the following:
private MapGesture.OnGestureListener yourGestureHandlerImpementation = new MapGesture.OnGestureListener.OnGestureListenerAdapter()
{
@Override
public boolean onLongPressEvent(PointF p) {
GeoCoordinate c = map.pixelToGeo(p);
// c is your geoccordinate on the map, where you clicked on the screen
// [...]
}
}