Listview items do nothing when clicked on. Using Listview on BetterSliding Panels

jdiperla

Member
Licensed User
Longtime User
Ok, So I have an app set up with 2 panels. The first panel loads the layout "Page1". The Second panel adds a listview. Every thing is Declared in the Sub Process section that needs to be declared.

In the Activity start, here is my code:

B4X:
ActiveBitmap.Initialize(File.DirAssets, "indicator_active.png")
InactiveBitmap.Initialize(File.DirAssets, "indicator_inactive.png")

'Initializing Panels, Loading the main screen up.
panels(0).Initialize("panels")
panels(1).Initialize("panels")
panels(0).LoadLayout("Page1")

'Creating the Listview widget, setting it up and adding it to the second panel
Listview1.Initialize(Listview1)
Listview1.Color = Colors.Transparent
Listview1.FastScrollEnabled = True
Listview1.Enabled= True
Listview1.ScrollingBackgroundColor = Colors.Transparent

'add an item to the list view
Listview1.AddSingleLine("Testing")

'Adding it
panels(1).AddView(Listview1, 0, 40, 320, 380)

'Adding additional Activity loading stuff
Activity.AddView(panels(0), 100%x, 0, 100%x, 100%y - 80dip) 'add the panel to the layout
Activity.AddView(panels(1), 100%x, 0, 100%x, 100%y - 80dip) 'add the panel to the layout
Activity.Color = Colors.RGB(60,118,193)

The Code for the Item Click is this:

B4X:
If Value = "Testing" Then
'Do something here
End If

Everything comes up displayed fine. The panels swipe fine. Everything I click on the Page1 layout clicks fine. However, when I click on a listview item, the event that is supposed to take place is not occurring. I tried to do requestfocus and I also did bringtofront with the listview.

I had the reverse problem before though. Before I had the listview on a page layout and panels(1) would load that page layout. When I got to the page, I couldn't scroll anymore, but once I clicked on an item in the listview, it would perform the functions it needed. I need my app to work properly in both area's. I need it to scroll/slide when there is a listview on the screen and I also need the items on the listview to be clickable. I have only been able to search for a solution to either one or the other problem, but not for both together.

I know its suggested to post the source to the entire app, but its a commercial app and I do not want to do that. Can someone help me out here with this and tell me what I am doing wrong? Thanks in advance.
 
Last edited:

mangojack

Expert
Licensed User
Longtime User
Change this line
B4X:
Listview1.Initialize(Listview1)

to this ..
B4X:
Listview1.Initialize("Listview1")

The click event ..
B4X:
Sub ListView1_ItemClick (Position As Int, Value As Object)

   If Value = "Testing" Then
      Msgbox ("testing","")
   End If

End Sub

Cheers mj
 
Upvote 0
Top