Присоединение к подсказкам здесь , здесь и здесь :
Вот полный код моего CustomMapView:
package net.alouw.alouwCheckin.ui.map;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Pair;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
/**
* @author Felipe Micaroni Lalli (micaroni@gmail.com)
*/
public class CustomMapView extends MapView {
public CustomMapView(Context context, String s) {
super(context, s);
}
public CustomMapView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public CustomMapView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
/**
*
* @return a Pair of two pairs with: top right corner (lat, lon), bottom left corner (lat, lon)
*/
public Pair<Pair<Double, Double>, Pair<Double, Double>> getMapCorners() {
GeoPoint center = getMapCenter();
int latitudeSpan = getLatitudeSpan();
int longtitudeSpan = getLongitudeSpan();
double topRightLat = (center.getLatitudeE6() + (latitudeSpan / 2.0d)) / 1.0E6;
double topRightLon = (center.getLongitudeE6() + (longtitudeSpan / 2.0d)) / 1.0E6;
double bottomLeftLat = (center.getLatitudeE6() - (latitudeSpan / 2.0d)) / 1.0E6;
double bottomLeftLon = (center.getLongitudeE6() - (longtitudeSpan / 2.0d)) / 1.0E6;
return new Pair<Pair<Double, Double>, Pair<Double, Double>>(
new Pair<Double, Double>(topRightLat, topRightLon),
new Pair<Double, Double>(bottomLeftLat, bottomLeftLon));
}
}