Android : paint parameter in Canvas.drawBitmap -
i use below code height , width of mobile screen , make random number in range , make image in random place of screen :
displaymetrics displaymetrics = new displaymetrics(); getwindowmanager().getdefaultdisplay().getmetrics(displaymetrics); int height = displaymetrics.heightpixels; int width = displaymetrics.widthpixels; int x = (int) (math.random() * height); int y = (int) (math.random() * width); canvas.drawbitmap(r.drawable.sizem, x, y, paint);
but dont no how can fill paint parameter in last line :
canvas.drawbitmap(r.drawable.sizem, x, y, paint);
check drawbitmap
paint paint used draw bitmap (may null)
try canvas.drawbitmap(r.drawable.sizem, x, y, null);
Comments
Post a Comment