Main activity with bottom navigation to another fragment with bottom navigation - java

Sorry for the vague question. But I'm stuck and I need help. I have this Activity which is my Main and it has bottom navigation with 4 fragments and I have another fragment named Book fragment that also has bottom navigation that hosted 3 fragments. Now in my second fragment from my Main activity, there's a recycler view with click listener. What I want to achieve is after clicking the item from the recycler view it will go to my Book fragment. But my problem now is, the bottom navigation in my book fragment didn't replace the bottom navigation from the main activity. Any guide on how can I achieve this?

Related

Go back to specific Fragment in Navigation Drawer from Activity

I would like to know how do I go back to a specific Navigation Drawer Fragment from a activity.
For example:
Navigation Drawer Menu Options:
Home Fragment
Products Fragment (Lists products, the user can click product to edit product activity)
Other Fragment
Now when I go back (Toolbar back button & android back button) from the Edit Product Activity it goes back to the MainActivity which has the Navigation Drawer, but it goes to the Home Fragment. I would like when the user goes back on the Edit Product activity to go to the Products Fragment.
How do I achieve this?
Thanks in advance.
Have you tried navigation component? https://developer.android.com/guide/navigation/navigation-getting-started
I fixed my issue by adding android:launchMode="singleTop" to my MainActivity class in the AndroidManifest.xml file.

How can I switch bottomnavigationview fragment to another one that is not a menu item

I have a bottom navigation view in Activity with 4 menu items (4 different fragments) that switches between them. The question is: how can I go from that menu fragment to another fragment that is not included in bottomnavigationview (deeper fragment hierarchy). I am using Android Navigation Framework to switch between fragments.
You could use a navigation drawer or tabs as well.
You can find more info here

Android - add Swipe View/tabs to only SOME fragments

Currently, my app is using a navigation drawer for my fragments. However, I have 2 fragments that are related, I would like to put these under one heading on the navigation drawer and then have 2 tabs to switch between the related fragments once I select that choice on the drawer.
Is this possible with only one activity or would I have to implement another activity specifically for the tab? I've considered only adding the tabs once the right fragment is committed but that leaves the question of how to remove it once I switch to a fragment that doesn't require the tabs.
I'd also like to avoid having to implement another activity as I am trying to keep the navigation available through my whole app. I'd rather not have to create an identical drawer and then have to keep things consistent between the 2 drawers.
Edit:
So far, I've managed to make a parent fragment that has a viewpager, fragmentpageradapter, and tablayout. Swiping between the 2 tabs does indeed shift between my 2 desired child fragments. However, I am unable to change a textview in one of my child fragments from my MainActivity. I'm guessing the reason why this is the case is because technically, my parent fragment is in view, not my child fragment. Any suggestions to get around this?
Hierarchy:
MainActivity
-Navigation Drawer
--Fragment1
--Fragment2
--Fragment3
--Fragment4
---FragmentPagerAdapter (under Fragment4, tabs)
----SubFrag1
----SubFrag2
Here's how you might use FragmentStatePagerAdapter to swipe across a Fragment:
http://developer.android.com/intl/es/training/implementing-navigation/lateral.html
I hope it help you.

Navigation Drawer app behaivour when open fragments

Im working with a Android app that uses Navigation Drawer. This app use the template provided with Eclipse ADT (when you select the navigation drawer template).
I dont understand the behaivour of the navigation drawer very well.
My main requeriment is make a "search" option, I have on the Navigation Drawer a EditText to get the query string from the user. I want that I press search button and open my SearchFragment getting the search query.
I know that I can make this:
Bundle args = new Bundle();
args.putString("searchQuery",searchQuery);
fragment.setArguments(args);
And this for getting:
getArguments().getString("searchQuery");
But I have the next:
MainActivity
NavigationDrawerFragment
SearchFragment
OtherFragments.. (I think this arent relevant in the question)
I dont understand where I can make this steps.
More data:
I have in the navigation drawer class the EditText with the setOnEditorActionListener for the search press.
Any info that I can add I will be add. Sorry my english
Thanks for the help
Navigation drawer is basically a component that show 2 pane in the way that one is the main pane (usually fragment) that is used to show content and the other one is usually a listview that is just used to choose which fragment to show in main pane
so if you want to switch between 2 different layouts you have to create 2 different fragments and then you can add or replace these fragments based on listview's selected item.
You may refer to below link for complete code
http://developer.android.com/training/implementing-navigation/nav-drawer.html
Hope it helps!

Overlap a layout with viewPager

maybe you can help me. I want to use viewPager to overlap an other layout. so for example: I the first Fragment. On this Fragment is a picture, than I swipe to the right and then the second Fragment should just go over the first Fragment. It's like in the Android Youtube App in which you swipe from left to right and the settings and etc go over the main layout(like in the picture). Can you tell me what i have to do?
Thanks a lot, Vinzenz.
picture:
http://i.stack.imgur.com/CQ8gL.png
What you're asking for is actually not related to ViewPager. There is another layout you can use to implement the same navigation pane overlay: DrawerLayout link: http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html

Categories

Resources