I am trying to extend/subclass ShapeDrawable. The results are really perplexing. My simple code should create a small dot and also a small triangle. And in fact, these shapes do appear on the mapview, where they are drawn. However, a second triangle with a somewhat different shape is also appearing and I have no idea why this is. Why the heck does my ShapeDrawable subclass create an extra triangle?
EXAMPLE SCREENSHOT --->> http://www.activemetrics.com/DrawableProb.png
private class CustomDrawable extends ShapeDrawable
{
public CustomDrawable() //GeoPoint point, MapView mapView)
{
}
public void draw(Canvas canvas)
{
canvas.drawCircle(0, 0, 2/*radius*/, getPaint());
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(2);
paint.setColor(Color.RED);
Path path = new Path();
path.reset();
path.moveTo(0, -10);
path.lineTo(5, 0);
path.lineTo(-5, 0);
path.close();
path.offset(10, 40);
canvas.drawPath(path, paint);
}
}