You can use the designer to add the bar buttons. It is simpler.
Code to add bar buttons:
B4X:
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
NavControl.ShowPage(Page1)
Dim b1, b2 As BarButton
b1.InitializeText("Button1", "Button1")
b2.InitializeText("Button2", "Button2")
Page1.TopLeftButtons = Array(b1, b2)
End Sub
Sub Page1_BarButtonClick (Tag As String)
Log("BarButtonClicked: " & Tag)
End Sub