clear and reset screen

zxxdaro

Member
Licensed User
Longtime User
I am developing an app that makes extensive use of webviews that are incorporated in layouts
When replacing a layout with another I find that it is placed over the old one and does not replace it. For example, buttons that were on the first are still apparent when I load the second.

How to I clear the screen before loading a new layout?
 

dbryan

Member
Licensed User
Longtime User
There are several approaches. In most cases the best option is to use multiple activities. Each one with its own layout.
Another option is to load the layout to a panel. Then when you want to remove the layout you can call Panel.RemoveView, create a new panel and load the layout to the new panel.

:sign0013:

I know this is an old thread but could you show some code examples? That usually explains things to me easier.
 
Upvote 0

Kbogle24

Member
Licensed User
Longtime User
B4X:
LoadLayoutToPanel ("simplelayout")

B4X:
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

Hope that helps some.
 
Upvote 0
Top