In the google maps javascript api you can add a groundoverlay and just pass two points, the point lefttoplat&lefttoplong and the point rightbottomlat&rightbottomlong
Fixed it myself.
For everyone with the same problem, here is my code:
public class GroundOverlay extends OverlayItem {
private MapView map;
private Bitmap overlay;
private GeoPoint topGeoPoint;
private GeoPoint bottomGeoPoint;
public Drawable drawable;
public GroundOverlay(
MapView map,
GeoPoint topLeftGeoPoint,
GeoPoint bottomRightGeoPoint,
Bitmap overlay,
String title,
String snippet) {
super(bottomRightGeoPoint, title, snippet);
this.map = map;
this.overlay = overlay;
this.topGeoPoint = topLeftGeoPoint;
this.bottomGeoPoint = bottomRightGeoPoint;
_init();
}
private void _init() {
Point topPoint = new Point();
Point bottomPoint = new Point();
map.getProjection().toPixels(topGeoPoint, topPoint);
map.getProjection().toPixels(bottomGeoPoint, bottomPoint);
int width = bottomPoint.x - topPoint.x;
int height = bottomPoint.y - topPoint.y;
drawable = overlayDrawable(overlay, width, height);
}
public BitmapDrawable overlayDrawable(Bitmap bitmap, int newWidth, int newHeight) {
Matrix scale = new Matrix();
float scaleFloat = (float)newWidth / (float)bitmap.getWidth();
scale.postScale(scaleFloat, scaleFloat);
Bitmap bitmapScaled = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), scale, false);
BitmapDrawable bm = new BitmapDrawable(bitmapScaled);
bm.setBounds(0,0,bitmapScaled.getWidth(),bitmapScaled.getHeight());
return bm;
}
}
You'll have to do the setMarker(drawable) somewhere and it should work. I'm doing that somewhere else (hence the public drawable).