You can find the java code of GridOverlay here.
The draw() method calculates the grid size, aiming to get a minimum of two latitude lines within the MapView's current display area. It draws the grid only on the portion of the map on display, and redraws it each time it is called, so applications using this overlay should call their MapView's invalidate() method after every zoom or scroll action. It puts the grid latitude or longitude on each grid line, with longitudes displayed vertically. The format in which these are displayed can be varied. Supported formats are LLD (degrees and fractions, e.g. 52.03365°), LLDM (degrees, minutes and fractions of minutes, e.g. 004°13.255'W) or LLDMS (degrees, minutes, seconds and fractions of seconds, e.g. 52°13' 4.3").
To include grid lines on your MapView (represented here as mMapView), define a GridOverlay and add it the map's overlays, thus:
{
GridOverlay ol = new GridOverlay(
Color.GRAY,
GridOverlay.LLDM,
mResourceProxy);
ol.setStrokeWidth(1.0f);
mMapView.getOverlays().add(ol);
}
mMapView.setMapListener(new MapListener()
{
@Override
public boolean onZoom(ZoomEvent ev)
{
updateMapPosition();
mMapView.invalidate();
return false;
}
@Override
public boolean onScroll(ScrollEvent ev)
{
updateMapPosition();
mMapView.invalidate();
return false;
}
});