Android Question CustomListView question

cwt

Active Member
Licensed User
Longtime User
I am starting to implement CustomListView in my Android app after having used it extensively in my iOS app.

I am running into a slight problem when I create a menu list by using a CustomListView - each choice on the menu goes to another activitly - this works fine. But when I return back from the activity to the menu, the item that was pressed still shows the pressed color. If I change the orientation then the CustomListView item clears back to the unpressed color. The menu list is created with AddTextItem.

What am I missing here? Thanks.
 

LucaMs

Expert
Licensed User
Longtime User
What am I missing here?
Senza nome.png
 
Upvote 0

cwt

Active Member
Licensed User
Longtime User
Using complex, not cross platform, activities instead of using simple and cross platform B4XPages. Everything will simply work as you expect.
I would love to use B4XPages but I need this app to work in both orientations, so I can't. I used B4XPages for my entire iOS app but need orientation changes in the Android app.

So your answer is that this problem is not fixable? I can always make the pressed color the same as the background color of the view, but that is not telling the user what is being pressed.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
So your answer is that this problem is not fixable
Try something like this. I think it will work for you. It worked for me. You may have to adjust the sleep time
B4X:
Sub clv1_ItemClick (Index As Int, Value As Object)
    If Index=0 Then
        Sleep(200)  'may have to adjust with less or more sleep time
        StartActivity(act2)
    Else
        Sleep(200)
        StartActivity(act3)
    End If
End Sub
 
Upvote 0

cwt

Active Member
Licensed User
Longtime User
Try something like this. I think it will work for you. It worked for me. You may have to adjust the sleep time
B4X:
Sub clv1_ItemClick (Index As Int, Value As Object)
    If Index=0 Then
        Sleep(200)  'may have to adjust with less or more sleep time
        StartActivity(act2)
    Else
        Sleep(200)
        StartActivity(act3)
    End If
End Sub
Your solution worked perfectly - did not even have to change the sleep value - thank you very much.
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Your solution worked perfectly

Another option that might work for you is to set the Pressed Color (Designer) to Transparent.
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Amazing what you see when you open your eyes.
 
Upvote 0
Top