android - How call onDraw method from another method to draw dynamically? -


i want redraw view method (say setprogress) in class extending view. how can this.

my view class is

public class spinview extends view {     private paint paint;     private context context;     private canvas canvas;     private rectf arcoval;      public spinview(context context) {         super(context);         this.context = context;      }     public spinview(context context, attributeset attrs) {         super(context, attrs, 0);         this.context = context;     }      public spinview(context context, attributeset attrs, int defstyle) {         super(context, attrs, defstyle);         this.context = context;     }       @override     protected void ondraw(canvas canvas) {         super.ondraw(canvas);         this.canvas = canvas;         display d = ((windowmanager)context.getsystemservice(context.window_service)).getdefaultdisplay();         int width = d.getwidth();         int height = d.getheight();         arcoval = new rectf((width/2-50), (height/2-50), (width/2+50), (height/2+50)); //      rectf arcoval = new rectf(200, 200, 300, 300);         paint = new paint();         paint.setcolor(color.blue);         paint.setstrokewidth(10);         paint.setantialias(true);         paint.setstrokecap(paint.cap.round);         paint.setstyle(paint.style.stroke);          canvas.drawarc(arcoval, 270f, 360, false, paint);     }      protected void setprogress(float angle){         paint = new paint();         paint.setcolor(color.yellow);         paint.setstrokewidth(10);         paint.setantialias(true);         paint.setstrokecap(paint.cap.round);         paint.setstyle(paint.style.stroke);          canvas.drawarc(arcoval, 270f, angle, false, paint);     }  } 

all want draw circular arc of yellow color on created arc of blue color. help?


Comments

Popular posts from this blog

My HTML document is not linking to my CSS stylesheet properly -

php array slice every 2th rule -

node.js - Sending sockets to client side, Error: Converting circular structure to JSON -