sagar suri
sagar suri

Reputation: 4731

How to use BottomNavigationView with single activity architecture

I am using the navigation architecture component for my project and planned to use Single Activity architecture. So my app flow is as follows:

SplashScreen->LoginScreen->HomeScreen

SplashScreen, LoginScreen and HomeScreen are Fragments.

I have only one activity which will have a NavHostFragment. As per the design, I want to add a bottomNavigationView in my HomeScreen but since the HomeScreen is a fragment where will I host the bottomNavigationView?

Upvotes: 2

Views: 586

Answers (2)

Shahadat Hossain
Shahadat Hossain

Reputation: 543

What do you want, in every fragment BottomNavigationView will be available? That means all the fragment can access the BottomNavigationView ?

Upvotes: 1

tynn
tynn

Reputation: 39863

You could put another NavHostFragment into HomeScreen and also add the BottomNavigationView there.

Your use-case sounds like it's actually containing two distinct navigations:

  • The main navigation SplashScreen->LoginScreen->HomeScreen
  • The home navigation within the HomeScreen

Upvotes: 2

Related Questions