Android Question looking for Library

mangojack

Expert
Licensed User
Longtime User
That code / declaration seems more associated witha B4i app / project
B4X:
Private Sub Application_Start (Nav As NavigationController)

Is it definitely a B4A app your working on ? What are you trying to do ?

Maybe post a few extra lines of code following this.
[code] paste / place your code between code tags ... [/code]
 
Upvote 0

MikeFree

Member
question is what library is missing ; code is B4A ???

i try to use a posted example ... creating button

compiler stuck at this line:
Private Sub Application_Start (Nav As NavigationController) ...

error description : unkwown Typ: navigationcontroller
Haben Sie eine Library-Referenz vergessen?
(you forgott a library reference ? )
Fehler in Zeile: 140 (Main)
Private Sub Application_Start (Nav As NavigationController)

'Button create at runtime

B4X:
Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.RootPanel.LoadLayout("1")
    NavControl.ShowPage(Page1)
    Page1.TopRightButtons = Array( _
     CreateFABarButton(Chr(0xF054), "right") _
     ,CreateFABarButton(Chr(0xF053), "left") _
     ,CreateFABarButton(Chr(0xF00C), "v") _
     ,CreateFABarButton(Chr(0xF00D), "x"))
    NavControl.ToolBarVisible = True
End Sub


Private Sub CreateFABarButton(text As String, tag As Object) As BarButton
    Dim bb As BarButton
    Dim b As Button
    b.InitializeCustom("BarButton", 0xFF007AFF, 0xFFE3EBF4)
    b.CustomLabel.Font = Font.CreateNew2("FontAwesome", 24)
    b.Text = text
    b.Tag = tag
    b.SetLayoutAnimated(0, 1, 0, 0, 30, 40)
    bb.InitializeCustom(b)
    Return bb
End Sub

Private Sub BarButton_Click
    Dim b As Button = Sender
    Log(b.Tag & " was clicked")
End Sub
 
Last edited:
Upvote 0

MikeFree

Member
Thanks Erel have found ...

B4X:
Sub Globals
 Private Buttons(6) As Button 
End Sub 

Sub Activity_Create(FirstTime As Boolean) 
  Private i As Int 
  For i = 0 To 5 
    Buttons(i).Initialize("Buttons") 
    Activity.AddView(Buttons(i), 10dip, 10dip + i * 60dip, 150dip, 50dip) 
    Buttons(i).Tag = i + 1 
    Buttons(i).Text = "Test " & (i + 1) 
  Next 

End Sub 

Sub Buttons_Click
  Private btn As Button 
  btn = Sender 
  Log("Button " & btn.Tag & " clicked") 
End Sub
 
Upvote 0
Top