SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

0 votes
0 answers
61 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
This template supports the sidebar's widgets. Add one or use Full Width layout.