Have implemented the new navigation architecture component on my app and i wonder how i can implement saving the state i have a five fragments when i navigate from one fragment to another the instance is restarted again and again wherever i navigate now i want to save the instance that when i come back to certain fragment i find the same instance as i left it if the button pressed they should stay the same.
Here is may activity having the five fragmenst
```
public class MainActivityCenterofInformation extends AppCompatActivity {
BottomNavigationView bottomNavigationView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_maincict);
setUpNavigation ();
}
public void setUpNavigation(){
bottomNavigationView = findViewById (R.id.bottom_nav_cict);
NavHostFragment navHostFragment = (NavHostFragment)getSupportFragmentManager ()
.findFragmentById (R.id.nav_host_fragment_cict);
NavigationUI.setupWithNavController (bottomNavigationView, navHostFragment.getNavController ());
}
}```
Have tried several ways like saving Ui state but it doesn't work also i need it in java not kotlin guys i cant read kotlin