Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim iv As ImageView
Dim c As Canvas
Dim btn As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
iv.Initialize("iv")
btn.Initialize("btn")
Activity.AddView(iv,0,0,100%x,100%y)
Activity.AddView(btn,40%x,90%y,20%x,10%y)
btn.Text="Draw"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btn_click
drawdotline(10%x,10%y,80%x,80%y)
End Sub
Sub drawdotline(x1,y1,x2,y2 As Int)
Dim lx,ly As Int
Dim rect1 As Rect
c.Initialize(iv)
rect1.Initialize(0,0,100%x,100%y)
c.DrawRect(rect1,Colors.Transparent,True,1)
lx=x1
ly=y1
Do While lx<(x2-1%x)
c.DrawLine(lx,y1,lx+1%x,y1,Colors.Blue,1)
c.DrawLine(lx,y2,lx+1%x,y2,Colors.Blue,1)
lx=lx+2%x
Loop
Do While ly<(y2-1%y)
c.DrawLine(x1,ly,x1,ly+1%y,Colors.Blue,1)
c.DrawLine(x2,ly,x2,ly+1%y,Colors.Blue,1)
ly=ly+2%y
Loop
End Sub