Hi,
I had the same problem today and I decided to write a method like this to flip between them:
Sub SwitchTo(pane As String)
For Each n As Node In Array As Node(pane1, pane2, pane3 )
n.Visible = False
Next
Select Case content
Case PANE1: pane1.Visible = True
Case PANE2: pane2.Visible = True
Case PANE3: pane3.Visible = True
End Select
End Sub
I bascially have 1 content pane and I load 3 layouts into it, each with it's own pane. I like being able to update all 3 panes in the background and switching to any of them when needed.
I don't know if this is the most idiomatic way to do it in B4J though?!
It look good, but I don't know how I can implement this to my code.
I have made a small sample with 3 Layouts. (see attachment) In this sample every Layout is put on top of the other.
How do I load them so that I can hide two of them, showing only one?
Would be very helpfull if you could implement your code into my sample.
Not questioning the validity of the proposed solution, but searching for a solution for my program I had the same issue. To solve it I remove all of the views before loading the new layout like this
B4X:
Dim teststring As String
teststring = LayoutLoadedList.Get(0) & ".bal"
If File.Exists(File.DirAssets,teststring) Then
Activity.RemoveAllViews
Activity.LoadLayout(LayoutLoadedList.Get(0) & ".bal")
Else
ErrorHandler("File is missing.")
End If
Again, not saying this is better, but for me it worked much better than putting everything into panels.
Are you sure that you code is for B4J and not for B4A? Didn't work for me in B4J.
As far as I know "Activity.RemoveAllViews" is B4A code and not for B4J.
Thanks Earl, that was what I was looking for. Mutch easier than the example from zyblux. But the solution from zyblux is great when you want to keep one panel open.