I have tabhost in program with few panels in tabs. Some of panels has a canvas. But while I added new tab and new canvas to new tab, I received NullPointerException.
First canvas works fine, but last canvas hangs on BTMCanv.Initialize(BTMPanel)
B4X:
Sub Globals
...
Private DashBoardPanel As Panel
Private BTMPanel As Panel
Private BMSSPanel As Panel
Private MnuPanel,MnSPanel As Panel
Private ScanBtn As Button
Private SaveLogBtn As Button
Private BtnResetRange As Button
Private DBCanv,Canv1,BTMCanv As Canvas
Private Tabs As TabHost
...
End Sub
Sub Activity_Create(FirstTime As Boolean)
...
If DashBoardEnabled Then DashBoardPanelCreate
...
If BMSType=1 Then BTMPanelCreate
...
End Sub
Sub DashBoardPanelCreate
DashBoardPanel.Initialize("DashBoard")
DashBoardPanel.Color=Colors.ARGB(255,64,64,64)
Tabs.AddTab2(" Dash" & Chr(10) & " Board",DashBoardPanel)
DashBoardPanel.Width=PanelsWidth
DashBoardPanel.Height=PanelsHeight
DBCanv.Initialize(DashBoardPanel)
...
End Sub
...
Sub BTMPanelCreate
BTMPanel.Initialize("BTMPanel")
Tabs.AddTab2("T",BTMPanel)
' BTMPanel.Width=PanelsWidth
' BTMPanel.Height=PanelsHeight
BTMCanv.Initialize(BTMPanel)
...
End Sub
First canvas works fine, but last canvas hangs on BTMCanv.Initialize(BTMPanel)