I have two images one circle and one arrow. I calculate distance between my current GPS coordinate and selected one on the map. Now I need to place arrow over circle image and put on arrow calculated distance. How can I implement this? Something like
EDIT: How to place arrow image in center and text over arrow?
public class CompassOverlay extends Overlay
{
private float angle;
public CompassOverlay(float angle)
{
this.angle=angle;
}
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
super.draw(canvas, mapView, shadow);
Bitmap back =BitmapFactory.decodeResource(mapView.getResources(),R.drawable.tfm_compass_back);
Bitmap arrowBitmap = BitmapFactory.decodeResource(mapView.getResources(),R.drawable.tfm_compass_arrow);
// Create blank bitmap of equal size for back
Bitmap canvasBitmap = back.copy(Bitmap.Config.ARGB_8888, true);
canvasBitmap.eraseColor(0x00000000);
// Create canvas
Canvas canvasBack = new Canvas(canvasBitmap);
// Create rotation matrix
Matrix rotateMatrix = new Matrix();
rotateMatrix.setRotate(angle, canvasBack.getWidth()/2, canvasBack.getHeight()/2);
canvas.drawBitmap(back, 0.0f, 0.0f, null);
// Draw bitmap onto canvas using matrix
canvasBack.drawBitmap(arrowBitmap, rotateMatrix, null);
BitmapDrawable bitmapDrawable= new BitmapDrawable(canvasBitmap);
canvas.drawBitmap(bitmapDrawable.getBitmap(), 0.0f, 0.0f, null);
return true;
}
}