Pre loader

Tag: Hide Show

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0 votes
0 answers
6k views

I have a simple app where the main activity has a FrameLayout that I use to load fragments in to. All fragments all loaded at the same time and I use hide/show to select what fragment to view.

However, when I add a chart to one of the fragments, then it loads fine initially, but if I hide it and then show it again, the app just stops. There isn’t any errors, it just stops responding.

If I remove the graph, everything works fine. Any ideas?

private void addAllFragments()
{
    getSupportFragmentManager().beginTransaction()
            .add(R.id.mainView, mainScreen, "MainScreen")
            .add(R.id.mainView, alarmScreen, "AlarmsScreen")
            .hide(alarmScreen)
            .commit();
}

private void loadFragment(String id)
{
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();

    for(Fragment f : getSupportFragmentManager().getFragments())
    {
        if(f.getTag() != id)
        {
            ft.hide(f);
        }
        else
        {
            ft.show(f);
        }
    }

    ft.commit();
}

private void loadMainScreen() {
    loadFragment("MainScreen");
}

private void loadAlarmsScreen() {
    loadFragment("AlarmsScreen");
}
Showing 1 result

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies