I'm a beguinner with Android programming, and in my app I have a Bottom Navigation View with 3 fragments.
One of those fragments has a button that allows the user to open another Activity to listen to music. But whenever the Activity is opened using Intents, the Bottom Navigation View from the previous screens disappears.
Can I open an Activity from a Fragment, but still have the Bottom Navigation View active?
Below is attached a link with an image of the mock-up I've made, hope it helps to clarify the question:
Thank you in advance for trying to help me out!
Reason
Well I guess (because I have no clue about your code base) the bottom navigation bar is a part of the main activity in which the fragments are being contained. When you are starting a new activity, the main activity with the bottom navigation goes as the music player layout loads.
Recommended Solution
Instead of keeping the music player as an activity make it a fragment and load in the view you are using as the fragment container in the main activity.
Another Way round (Not recommended)
Make another view of the bottom navigation bar in the music player activity and map the actions of the button click to load the main activity.
It might be a bit time taking and buggy initially but with debugging and testing, you can make it work.
But again its not a good option.
Related
I'm using cicerone and single activity approach. When the application starts, the first three seconds I'm showing splash fragment inside my activity and so redirect to home fragment. Now I need to add to my application bottom navigation. Is it possible to add bottom navigation using single activity approach and cicerone. Or will I have to add another activity for the holding bottom navigation ?
Unfortunately, I could not find examples of projects with cicerone, single activity and bottom navigation.
My main goal is to save single activity, please tell me if it is possible to achieve this ?
I have read a couple of times in tutorials that it is recommended not to show the bottom navigation bar after navigating deeper into each of the main fragments of each section.
So if you have 3 sections shown in the bottom nav bar, only the 3 landing fragments will show that bar, the rest of the fragments (as you navigate deeper) will hide it.
I know it has something to do with having a single backstack, but I don't really know the real explanation or what would be the problem of not hiding it.
Could someone explain please?
Cheers!
I believe this can attributed to the Master-details UI pattern.
Master-detail wikipedia
Android tutorial - Master-Detail views with Navigation Components
You have main screen which is an activity that acts as you application single entry point, the bottom navigation bar holds the main points of interest you want your user to interact with or engage, with say [Feed, Messages, Profile], each one of those is a master view that has a set of child view linked to it, for example feeds to have your feeds for categories like [Music, Technology, ..].
From a UX point of view hiding the bottom nav-bar when navigating the children of a main/master view and have back button or home button that returns you to main screen that way your user understands the flow of your application and has easier time navigating it, and may not accidental click the [profile] button while scrolling down the feeds list.
I have an application where it is required to persist the bottom navigation across multiple screen. Now naturally bottom navigation works well with fragments but the problem is that my other fragments also have other screens to call which is usually delegated back to the handling activity.
With said, when i tried implementing the bottom navigation with fragments the activity becomes a God Activity where it handles all fragments.
So my solution was to start an activity instead. But the problem with this approach is that every start of the activity the activity transition makes it obvious an activity is being started. I tried setting off the activity transition to avoid this but now Im left with a very static page which just suddenly changes. I still want my views to animate smoothly between screen changes.
Can someone give me an advice here. Heres what I would want to achieve in summary:
1) make it seem the bottom navigation was not changed/moved (and hopefull still have the shifting animation if possible)
2) animate smoothly between screen changes
3) also still have the capability of having shared element transition if possible.
Please help me here. Thank you so much in advance.
I have to show a floating button that will be added in WindowManager so it remain on the top of all Activities. (I have done this part using https://github.com/marshallino16/FloatingView)
When that button is tapped I have to open screen and show detail view and navigate between other views. To achieve this thing I can do following things either adding
1 - PopUpWindow
2 - Dialog
But I cannot provide navigation using either of them. So my questions is.
What is the best way to add multiple views and providing navigation between them while keeping everything above the application that is running it.
How can we add Activity so that it won't pause user application?
You should open Activity and implement all navigation inside it.
Android may pause activities behind, so make your Activity only for part of the screen.
Inside Activity hide floating button and show it again on exit.
I'm searching all over but cannot seem to find a answer to this.
I have my main HomeActivity view which contains a SlidingDrawer in the main.xml layout. The sliding drawer works fine. What I'd like to do though is that when the SlidingDrawer is opened, I want to launch a new activity in the sliding drawer view, and when the drawer closes it drops a result.
So in theory I'm looking at launching an activity with the startActivityForResult method and when the SlidingDrawer closes, processing the result? Is this at all possible or am I out to lunch?
I have recently given this some thought and although actually having the activity itself display inside the SlidingDrawer contents is impossible, theoretically you could simulate this buy copying the layout you are going to, and putting that as the contents, then as soon as the sliding drawer is done, go to the new activity. I haven't tried this myself but it might actually look nice. It won't be perfect but I think it could work.
Another way is to merge both those activities into one and use the sliding drawer to show the other layout.
Anybody have any better ideas I'd love to hear them also!