In my program I made many layouts and I use often to call a sub to change layout complete of labels and buttons (.bal).
Every layout has a background image (image file) defined in designer (the images are in jpg format with a dimension <100k).
Randomly one of the panels that I load displays a black background instead of the image (all the labels and buttons are present and work correctly).
The same panel can show a black screen or an image randomly when loaded and this happen to all layout that I load (is not correlated to a specific panel).
The code that I use to load the panel is the following:
Sub LoadLayoutToPanel (Layout As String)
If Panel1.IsInitialized Then
Activity.RemoveViewAt(0)
End If
Panel1.Initialize("")
Panel1.LoadLayout(Layout) 'layout that I want load
Activity.AddView(Panel1, 0, 0, 100%x, 100%y)
End Sub
How do I resolve this issue?
I tried changing the code as below but the problem is still present, randomly the panel background become black:
Sub LoadLayoutToPanel (Layout As String)
If Panel1.IsInitialized Then
Activity.RemoveViewAt(0)
End If
Panel1.Initialize("")
Panel1.removeview
Panel1.LoadLayout(Layout) 'layout that I want load
Activity.AddView(Panel1, 0, 0, 100%x, 100%y)
End Sub