How to find which position is clicked on screen or MapField in blackberry

269 views Asked by At

I am building a map application. In which I am placing several bitmap and when i click on the bitmap some event is occurring. For that I need to know at which position I have clicked on the screen on the basis of that i'll get the lat & long pair for my app... Is it possible to get the exact x,y position of the screen where we clicked? Or is there any other way of finding which lat and long position is clicked on the MapField ?

1

There are 1 answers

1
Tamar On

You can center the map to the tapped location and get the coordinates of the tap that way:

  1. Get the X and Y from the TouchEvent in your extended MapField
  2. Get the current center of the screen from the getXYPoint function
  3. Calculate the difference and use it to move the center of the map using the move function
  4. The tapped location is now the center of the screen, get the coordinates using the getLatitude and getLongitude functions.

Hope this helps!