Help Needed Quick

baron159

Member
Licensed User
Longtime User
I have a program that requires multiple layouts. And I have them all created.
When the program stats it creates activity will normal and I have it set up to load the first layout.

Activity.LoadLayout("firstscreen")

and that works fine but when a button is push on this screen I need it to "unload" the current layout and load the next one. Can this be down? If so could you guys upload and example.

Thanks you guys are always so helpful
 

Woinowski

Active Member
Licensed User
Longtime User
Multiple activities, not only layouts

The Android-like solution would not be one activity with multiple layouts but multiple activities, each with one layout. There is an example in the beginner's guide.
 
Upvote 0

Valserwasser

New Member
Licensed User
Longtime User
I have a program that requires multiple layouts. And I have them all created.
When the program stats it creates activity will normal and I have it set up to load the first layout.

Activity.LoadLayout("firstscreen")

and that works fine but when a button is push on this screen I need it to "unload" the current layout and load the next one. Can this be down? If so could you guys upload and example.

Thanks you guys are always so helpful

Hi Baron

I'm not sure if I understood what your issue is. Try the following code. Let us know if this was helpful.

Cheers

B4X:
Sub Globals
      Dim New_Layout as Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("Main_Layout")
   New_Layout.Initialize("")
   New_Layout.LoadLayout("New_Layout_file_from_Designer")
   Activity.AddView(New_Layout, 0,0,100%x,100%y)
   New_Layout.Visible = False
End Sub

Sub Load_new_Layout_Button_Click
        New_Layout.Visible = true
End Sub

Sub Unload_Layout_Button_Click
        New_Layout.RequestFocus
        New_Layout.Visible = False
End sub
 
Upvote 0

baron159

Member
Licensed User
Longtime User
Would a better option be...

Would a better option be to use a new module?

I've never worked with that before so any tips and code examples would be helpful if you think that this is a good option.
 
Upvote 0

baron159

Member
Licensed User
Longtime User
Thank You

Thank you for all your help guys....getting me through the stupidity i was overlooking. LOL. Well thank you

Happy Programming,
baron159:sign0089:
 
Upvote 0
Top