0

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  
  • I would recommend finding a support forum in your native language, the question is a bit hard to read. In any case it would help if you indicate the technologies you used (in the question and/or in tags). – Jeroen Nov 07 '11 at 07:24

1 Answers1

0

It is hard to tell the problem from this code. You should however call Panel1.RemoveView to remove the panel from its parent.

Erel
  • 1,802
  • 2
  • 15
  • 58