Android Question Listview Click Question

brianwiz12

Active Member
Licensed User
Longtime User
Code
B4X:
Sub Activity_Create(FirstTime As Boolean)
    
    Activity.LoadLayout("1")
    ToolbarHelper.Initialize
    ToolbarHelper.ShowUpIndicator = True 'set to true to show the up arrow
    ACToolBarLight1.InitMenuListener
    sm.Initialize("sm")
    Dim offset As Int = 100dip
    sm.BehindOffset = offset
    sm.Mode = sm.LEFT
    Dim lftMenu As Panel

    'menu that controls the portion of item view
    lftMenu.Initialize("")
    sm.Menu.AddView(lftMenu, 0, 0, 100%x - offset, 100%y)
    lftMenu.LoadLayout("Left")
    ListView1.AddSingleLine("Home")
    ListView1.AddSingleLine("Trivia Episodes")
    ListView1.AddSingleLine("Coming Soon")
    ListView1.AddSingleLine("About App")
    'For i = 1 To 4
    'ListView1.AddSingleLine("Item " & i)
    '    ListView1.AddSingleLine("Item " & i)
'    Next
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub ACToolBarLight1_NavigationItemClick
    sm.ShowMenu
    ListView1.Initialize ("Home")
    ListView1.Initialize ("Trivia Episodes")
Trivia.click
    ListView1.Initialize("Coming Soon")
    ListView1.Initialize("About App")

End Sub

With the code as is When i load the menu it goes right to the trivia section

Without Trivia.click it loads the menu.

How do i make the listview items click able to other modules?
 

brianwiz12

Active Member
Licensed User
Longtime User
Update i got it to work with Buttons. Still interested in listview way.

Also this navigation is only for the main page? How do i get it to show up on all modules in the app without hard coding it?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is no reason to use ListView here. Use xCustomListView instead.

I don't understand this code:
B4X:
  ListView1.Initialize ("Home")
    ListView1.Initialize ("Trivia Episodes")
Trivia.click
    ListView1.Initialize("Coming Soon")
    ListView1.Initialize("About App")
Looks wrong.

You can implement the navigation feature in a class and create a class instance in each of the activities.
 
Upvote 0
Top