My problem is that for my app I have to send an API which contains some parameters among which one is the area of the map view. For that I have to calculate my map view area.
For the location search functionality when some address is given to the search box by reverse Geocoding I am getting the lat lng for that address. Considering that lat lng as center pt. when I calculate the map view area every time it gives some different lat lng value for left-top and right-bottom co-ordinates.
here is my codding:
and for calculation the map view area:
- [*] GeoPoint p = mapView.getProjection()
- .fromPixels((int) mapView.getHeight(),
- (int) mapView.getWidth());
- Double lat = p.getLatitudeE6() / 1E6;
- Double lng = p.getLongitudeE6() / 1E6;
- GeoPoint q = mapView.getProjection().fromPixels((int) 0,(int) 0);
- topCoordinate = "" + lng + "," + lat;
- Double lat1 = q.getLatitudeE6() / 1E6;
- Double lng1 = q.getLongitudeE6() / 1E6;
- bottomCoOrdinate = "" + lng1 + "," + lat1;
But I should get same value every time. Is not it!
Please help as soon as possible.