android - Canvas.drawbitmap not working -


i have draw line on map. due requirement of special line effects, had create separate bitmap , draw lines on bitmap, using temporary canvas. when completes drawing lines, render main canvas. unfortunately, below code not working 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 please tell me i'm doing wrong here?

update: see i'm doing wrong. created new class , extended drawable. in class, override draw method , used same code parameter canvas, , worked. don't know why it's not working on mapview. please me out?

you should rather use view's getwidget() , getheight() instead of taking size of canvas when creating bitmap.