then use startactivity(name)
e.g.
StartActivity(NoteInput) 'name of module
Sub Globals
Dim Panel1 As Panel
End Sub
Sub Activity_Create (FirstTime As Boolean)
LoadLayoutToPanel("layout1")
End Sub
Sub LoadLayoutToPanel (Layout As String)
If Panel1.IsInitialized then
Activity.RemoveViewAt(0)
End If
Panel1.Initialize("")
Panel1.LoadLayout(Layout)
Activity.AddView(Panel1, 0, 0, 100%x, 100%y)
End Sub
I used Erel's suggestion above. When I load the 1st layout, it works fine. But when I try to load the 2nd layout, I get an error:
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
I tried, adding Activity.RemoveView right after the Activity.RemoveViewAt(0) in the If condition, however, it still gives the same error.
panel1.removeView