android - invalidate only works in custom view -
so created view called "drawable view"
class drawableview extends view{ context mcontext; int touches=0,k,xoffs,clicks=0; double x_1 = 0,x_2=0; private float mlasttouchx, mlasttouchy; public drawableview(context context) { super(context); mcontext = context; } .... @override protected void ondraw(canvas canvas){ paint mypaint = new paint(paint.anti_alias_flag); canvas.drawcolor(color.blue); mypaint.setcolor(color.white); canvas.drawcircle(200, 100, 20, mypaint); } ..... more code.... } and can invalidated within ondraw command! ie: calling "invalidate();" @ end of ondraw command causes loop.
i have tried many times call g_draw.invalidate(); or g_draw.postinvalidate(); (g_draw name of created drawable view)from other classes , main activity class , doesnt work. why , how can fix it?
thanks
if want continious ondraw invoking try doing in thread. create thread, , run method try doing postinvalidate.
it worked me.
another thing when draw circle once, next time wont make difference - same.
Comments
Post a Comment