ListView click item problem

walterf25

Expert
Licensed User
Longtime User
Hello all, i was wondering if anyone has come across this problem i'm having with the listview, basically i have 4 different activities and each activity has a listview which displays different items in them. when you click on any item in the first listview in the first activity it takes you to the next activity which also shows another listview with more items in them. the problem i'm having is that sometimes when you go to the last activity and go back to the previous activity, and you click on any of the items of the listview in the previous activity the click_item event does not work, has anyone had this same issue, if so how did you guys get around it?

thanks,
Walter
 

walterf25

Expert
Licensed User
Longtime User
Listview Item Click

Hi Klaus, this is what i have, basically the first time i run the app it runs smooth, but as i go back from the last activity to the previous one and so on, the
ListView1_ItemClick does not.

this is my code
B4X:
Sub lstDirection_ItemClick(Position As Int, Value As Object)
               busdirection = Value
      BusStopTag = StopTagList.Get(Position) 'Get the Route number
      Log(busdirection)
      StartActivity(StopTags) ' this works the first time i launch the app, but as i go back from the last activity to the previous until i get back to this activity, the startactivity(StopTags) does not work.

End Sub

here are some screen shots of the app running so you can see that it works the first time.

BusLines.jpg
Directions.jpg
Stops.jpg
schedules.jpg
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Sorry, but I asked you to post your project or at least a smaller project that shows the problem, why didn't you post it ?
You see the whole code and you don't find the problem how do you expect us finding the problem without having any code to look at. Most of the time the problem is not in the small code snippets where you think it is, but it's somewhere else. So without having the whole code it's impossible to help you.

Best regards.
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
How are you handling state changes?

What happens when activity 1 calls 2?

I suspect something there but just like Klaus has said we need the full code to make any sense.

Regards Ricky
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Here it goes

Hi Klaus, here's the entire project
View attachment 11188

hopefully you can see what the issue is, the problem happens when you go back to the Direction activity and you click on any of the items in the listview, it should take you to the next activity but it doesn't.

Thanks.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I tested your code and got an error with the Manifest File.
So I changed it to a standard one.
Then I don't have the advertising libraries and I'm not interested in.
So I commented out all the lines involved with these libraries.
Doing this I got a working version on the Emulator and my Nexus One device.
Runing the program several times on both, Emulator and device, I never got any trouble with the ListViews_ItemClick events.
Attached you find the zip file of the modified version I tested.

Best regards.
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Click_Item event

Thanks for taking a look at my code Klaus, it seems that this problem is specific to my phone which is a motorola photon, i have also tried the same code in my emulator and it works without any problem.

Thanks Klaus,
Walter
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I have just come across a similar problem that manifests itself on both my phone (HTC sensation) and tablet Zenithink ZT280.

I am re-writing some code of a large project using Classes, I have managed to isolate the problem in the small attached project.

When a choice is made from the listview, a second page is called, on returning from that by capturing the standard android 'back' key the items cannot be selected until the list has been 'flung'. Just moving the items slightly won't do it. The touch is still working as the list can be moved but items not selected.

Can anyone verify this with the attached project please. I thought I was going mad. I thought I might have had a panel covering it to start with, but this small app proves that is not the case.

Thanks
 

Attachments

  • lt.zip
    8.2 KB · Views: 284
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Thanks Erel, I'll probably have to go back through some lazy coding and make sure some panels are invisible rather than just covered when I don't want them, but that has sorted it.
 
Upvote 0
Top