I'm using android bottom navigation component in my app. As these lines on my MainActivity :
BottomNavigationView navView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
R.id.navigation_home,
R.id.navigation_product,
R.id.navigation_setting
).build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(navView, navController);
There are 2 tabs inside ProductFragment using viewpager and each tabs load REST API from the server and bind to Recyclerview. I found that everytime I navigate to Product it has about 2 seconds lag until the fragment showed up. Is there any work around for the lag ?