1

I fill my RecyclerViewAdapter using FirebaseUI. If I click on a Fragment in BottomNavigationView for the first time, the UI freezes for a few milliseconds due to firestore queries etc. I'm thinking it would be good to load all fragments at once and keep the backStack.

My code in my MainActivity.java looks like this:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);
        BottomNavigationView navView = findViewById(R.id.nav_view);
        NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
        NavigationUI.setupWithNavController(navView, navController);

I already saw this question but that's for keeping the fragment alive once it is loaded.

Is there any way to load all fragments at once?

Md. Sabbir Ahmed
  • 850
  • 8
  • 22

0 Answers0