Select tab within fragment
See original GitHub issueFirst of all, awesome library. I am just curious, is it possible to select specific tab from a fragment? I have 5 different fragments, and i need to update my activity to see changes. If i do so, i need to go to the previous tab. This is bad for the end user, cause he lands on the first tab.
How could i attach the BottomBar within fragment and then select tab like this:
mBottomBar.selectTabAtPosition(3, false);
Thanks a lot! 👍
Issue Analytics
- State:
- Created 7 years ago
- Comments:8
Top Results From Across the Web
android - Fragment Tabs inside Fragment - Stack Overflow
I have in my Main Activity an Action bar navigation using tabs using Fragments (with Material Design), as below which works well, but...
Read more >Tab Layout with Fragments | Android Studio Tutorial - YouTube
Presenting brand new video: In this video you will learn how to create Tab layout in android to display different fragments with the...
Read more >Create tab layout with fragments in Android studio 2020
Learn how to implement tab layout in Androidx with different fragments ,for this we will choose a tabbed activity and then we will...
Read more >Tab Layout with Fragments in Android Studio - YouTube
Tab layout with Fragments in Android Studio || Tab layout with ViewPager || Tab layout || 2021Follow me on Instagram: ...
Read more >How to Implement Tabs, ViewPager and Fragment in Android ...
Go to app > res > layout > right-click > New > Layout Resource File and after that, it asks for the file...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@mag2007, Sure. So in your MainActivity where you define
BottomBar, make itpublic staticlike,And then in your fragment you can access it using
MainActivity.mBottomBar@mag2007 @PsyGik i would TOTALLY advice AGAINST this approach, you should not be depending in things like this to be inside static variables, also because you are making this static this means that the Context and all the things attached to it will be kept alive FOR EVER. Also if that wasn’t enough if your activity were to appear more than one time, the latest one will override the first one and then you get into a weird state that will create very hard to debug problems. please DON’T DO THIS, and read all the android best practices in the developer documentation.