'Class module
Sub Class_Globals
#if b4i
dim parent as Page
#else if b4a
Dim Parent As Panel
Dim Owner As Object
Dim Event As String
#End IF
Public Title As String="Your Title"
#if b4i
Public Form As Page 'this is the form to hold your layout
#else if b4a
Public Form As Panel 'this is the form to hold your layout
#End IF
Public Visible As Boolean 'just a place holder
'views
Private Button1 As Button 'within layout file
End Sub
'Initializes the object. You can add parameters to this method if needed.
#IF b4a
Public Sub Initialize(AEvent As String, AParent As Panel, ATargetModule As Object) 'add more if you want/need to
Event=AEvent
Parent=AParent
Owner=ATargetModule
Form.Initialize("Form")
Parent.AddView(Form,0,0,Parent.Width,Parent.Height)
Form.LoadLayout("ALayout")
'seem to need this to make the form/panel opaque after loading a layout file
Dim cd As ColorDrawable
cd.Initialize2(Colors.ARGB(255,0,0,0),0,0,0)
Form.Background=cd
Form.Visible=False
#ELSE IF #b4i 'this is just a quick example of multi platform
Public Sub Initialize 'add more if you want/need to
Form.Initialize("Form")
Form.RootPanel.LoadLayout("ALayout")
form.pagetitle=title
#END IF
'do any other initialization required
End Sub
Sub getVisible As Boolean
Form.Visible
End Sub
Sub setVisible(value As Boolean)
Form.Visible=value
If value Then
#IF b4a
Form.BringToFront 'just in case
#ELSE IF b41
#END IF
End If
'process anything else we want to do
End Sub
#if b41
sub Form_Appear
end sub
#end if
Sub getTitle As String
Return Title
End Sub
'any view events or other methods for this particular "activity"
Sub BUtton1_Click
'do something
End Sub