Android Question How to load an activity/view

Rams007

Member
I'm totally confused it's changed from a year ago.
I'm using the simple_example_B4XDrawer example. I have added a new view in the designer and called it "2".

So I have two views in the designer, 1 and 2. 1 has the simple example menu and on the other I have a button and webview.

I want to load view 2. So something like.

B4X:
Sub Activity_Create(FirstTime As Boolean)

    'Do not forget to load the layout file created with the visual designer. For example:

    'Activity.LoadLayout("Layout1")

    Drawer.Initialize(Me, "Drawer", Activity, 280dip)

    Drawer.CenterPanel.LoadLayout("1")

    Drawer.LeftPanel.LoadLayout("1")

  

    Activity.LoadLayout("2"). <--- this line

  

    webview1.LoadUrl("https://www.google.com")

  

    ListView1.SingleLineLayout.Label.TextSize = 16

    ListView1.AddSingleLine( cs.Initialize.Typeface(Typeface.MATERIALICONS).Size(22).VerticalAlign(3dip).Append(Chr(0xE145)).PopAll.Append("  Item 1") )

    ListView1.AddSingleLine( cs.Initialize.Typeface(Typeface.MATERIALICONS).Size(22).VerticalAlign(3dip).Append(Chr(0xE190)).PopAll.Append("  Item 2") )

    ListView1.AddSingleLine( cs.Initialize.Typeface(Typeface.MATERIALICONS).Size(22).VerticalAlign(3dip).Append(Chr(0xE86A)).PopAll.Append("  Item 3") )

    ListView1.AddSingleLine( cs.Initialize.Typeface(Typeface.MATERIALICONS).Size(22).VerticalAlign(3dip).Append(Chr(0xE3B0)).PopAll.Append("  Item 4") )

    ListView1.AddSingleLine( cs.Initialize.Typeface(Typeface.FONTAWESOME).Size(22).VerticalAlign(3dip).Append(Chr(0xF1C0)).PopAll.Append("  Item 5") )

    ListView1.AddSingleLine( cs.Initialize.Typeface(Typeface.FONTAWESOME).Size(22).VerticalAlign(3dip).Append(Chr(0xF0E4)).PopAll.Append("  Item 6") )

    ListView1.AddSingleLine( cs.Initialize.Typeface(Typeface.FONTAWESOME).Size(22).VerticalAlign(3dip).Append(Chr(0xF27B)).PopAll.Append("  Item 7") )

    ListView1.AddSingleLine( cs.Initialize.Typeface(Typeface.FONTAWESOME).Size(22).VerticalAlign(3dip).Append(Chr(0xF085)).PopAll.Append("  Item 8") )



End Sub
 

Biswajit

Active Member
Licensed User
Longtime User
B4X:
    Drawer.CenterPanel.LoadLayout("2")

    Drawer.LeftPanel.LoadLayout("1")

 

    'Activity.LoadLayout("2"). <--- remove this
 
Upvote 0
Top