I have to draw a line on the map. Due to the requirement of special line effects, I had to create a separate bitmap and draw lines on that bitmap, using a temporary canvas. Now When it completes drawing lines, I render it to the main canvas. Unfortunately, the below code is not working for me.
@Override
protected void draw(final Canvas canvas, final MapView mapView, final boolean shadow) {
Bitmap pathBitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Config.ARGB_4444);
Canvas tempCanvas = new Canvas(pathBitmap);
tempCanvas.drawPath(mPath, this.mPaint);
canvas.drawBitmap(pathBitmap, 0, 0, null);
}
Could anyone please tell me what I'm doing wrong here?
Update: To see what I'm doing wrong. I created a new class and extended it with Drawable. In that class, I override the Draw method and used the same code with only parameter Canvas, and it worked. But don't know why it's not working on the MapView. Anyone please help me out?