I have an app with bottom navigation fragment activity
I have placed text views and buttons on my home fragment.
further these fragments are placed in a frame layout.
when I launch my app my home fragment shows nothing just blank screen it loads everything when I
switch between fragments.
I want to fix this, so that when I launch my app everything that is on my home fragment shows up.
because you didn't specify the first fragment to show,
in the onCreate you have to do this :
first checked the bottomNavigation item, that you want to start with :
bottomNavigation.getMenu().findItem(R.id.item).setChecked(true);
then put the first fragment in frame layout
Related
https://github.com/oneHamidreza/MeowBottomNavigation
i have implemented bottom navigation bar using above library but when i press back button it is directly closing the app even when i am in another fragment alsp.
please guide me that when i press back button it should come to home fragment and when i am in another fragment the back button should work accordingly to that respective fragment.
when i press back button in bottom navigation bar it should come to home fragment if it is in another fragment other than home if it is in home fragment then it can close app.
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?
I am trying to create navigation system between three fragments of an app, using buttons. I was following these tutorials to do that:
https://developer.android.com/guide/navigation/navigation-getting-started
https://www.youtube.com/watch?v=akuONx5RTy8
While doing so, the second and and third fragments could form connection with no problem. But upon clicking on the first fragment no any node appeared on the right side of the fragment like it did on the other fragments, because of which the first fragment couldn't connect with other fragments.
How do I connect first fragment to the second?
I'm using a bottom navigation view which has 2 menu items. Each menu item upon clicking loads a fragment onto the MainActivity.
The first fragment is the home fragment where a RecyclerView shows a list of items and the second fragment contains a simple form.
now whenever I switch back and forth between these fragments, their previous states are lost and the fragment is recreated. This is a big issue for me because suppose I scroll to, let's say the 15th item of the list present in the home fragment. After scrolling, I navigate to the second fragment and then I navigate back. What happens is that the home fragment gets recreated and to see the 15th item I have to scroll again.
What should I do to handle this?
I have a TabLayout with two Tabs or Fragments.
In one Fragment I want to save for example text from edittext before switching tab or closing app.
I tried with onStop. It save the content before closing app. But when I go to second tab, the app closes without exception.
Why? Are the a solution for this problem?