android - Prevent code execution in Eclipse Graphic Layout preview -


i want draw custom view, have draw method:

@override  public void ondraw(canvas canvas) {      paint.setstyle(paint.style.fill);     canvas.drawcolor(color.white);     paint.setcolor(color.red);     if(!path.isempty())         canvas.drawpath(path, paint); }  

in eclipse graphic layout preview nullpointerexception. (because of course graphic layout preview path null). there way (for example using @ or other instructions) prevent graphic layout preview execution of

canvas.drawpath(path, paint); 

try this

@override  public void ondraw(canvas canvas) {      paint.setstyle(paint.style.fill);     canvas.drawcolor(color.white);     paint.setcolor(color.red);     if(path != null && !path.isempty())         canvas.drawpath(path, paint); }  

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -