I have a problem with navigating user in my App, when he clicks “Back” on his device. I want to let him exit the app from the first tab and it works. From other tabs, I want to redirect him to the first tab.
It works, but two tabs on the tab-bar are selected/active. I was trying maaany things all day and nothing worked.
I found exactly the same issue on StackOverflow and commented on it there to don’t double the topic.
If You would like to respond there or here -> I would really appreciate!
While you wait for better answers, I would like to make a plea on behalf of UI consistency.
Tabs are popular with mobile designers for the same reason virtual workspaces are with window managers: they allow multiplexing of scarce screen real estate. I use i3, which probably leverages virtual workspaces more heavily than most other window managers out there. It would weird me out to no end if suddenly there was only one workspace that I could manually close, and even more so if attempting to close other workspaces instead diverted me to workspace #1.
That’s what I’m hearing when I read this:
That is not how tabs should behave. “Who are you to tell me how tabs should behave? It’s my app and I’ll decide how tabs behave”, you may be tempted to say.
I have lost track of the number of threads I have seen here from people who try to abuse tabs and then complain that they run into technical problems doing so.
Tabs should be like rooms in a house. I’m only in one room at a time, so the lights don’t have to be on in the rooms I’m not in, but it is not the rooms’ job to try to dictate which one of them I should be in, and when I leave a room and go back to it later (which I must be able to do freely), everything should be just as I left it.
As a bonus, when you do use tabs this way and only this way, you run into far fewer technical troubles with them.
I don’t know how similar your code is to OP’s, but everything I said earlier in this thread I still believe, so please don’t abuse tabs to do surprising routing things.
That being said, every single “this thing I’m doing with selective back button handlers works great until I build the app for production” thread I can remember seeing here was caused by relying on class names as strings.
i receive a notification on my phone and i click on it, this call in the app the navigation to redirect to tab 3
tab 1 and tab 3 are highlight like they are selected (bug!)
i click anywhere on the page, nothing occure but highlight on tab 1 disappear (back to normal ! ) and tab 3 still highlight (hopefully!)
i suppose the real tab selected is the tab 3 when navigation is call.
Only one tab can be selected right? the tabs.getSelected() method show the tab 3.
So the display is wrong, a refresh of the display of the tab bar is missing.