Android Question Canvas Draw does not display

Discussion in 'Android Questions' started by Alberto Michelis, Aug 12, 2015.

  1. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    Im doing a loop with which I draw boxes and texts using this code:

    r.Initialize( Xpos, Ypos, BoxWidth+Xpos, BoxHeight+Ypos)
              c.DrawRect(r, BGcolor, 
           r.Initialize( Xpos, Ypos, BoxWidth+Xpos, BoxHeight+Ypos)
    Colors.DarkGray, False2)   
    If BoxWidth<80 Then
    " "&HeatDia&"%",Xpos+10,Ypos+30,Typeface.DEFAULT,10,FGcolor,"LEFT",90)
    End If
    Problem is the boxes and texts does no appears in the screen till I touch it.
    What am I doing wrong?
  2. klaus

    klaus Expert Licensed User

    You must Invalidate the view of the Canvas after the drawing.
    Example: Activity.Invalidate
    You can either Invalidate the whole view or only a rectangular part with
    Activity.Invalidate2(Rect) or
    Activity.Invalidate3(Left, Top, Right, Bottom)

    This forces a view update.
    RandomCoder likes this.
  3. Alberto Michelis

    Alberto Michelis Active Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice