Users Pricing

forum

Home Forums when app is restored the fragment is visible only for a second? – MindStick

when app is restored the fragment is visible only for a second?

Anonymous User 2211 16 Nov 2014

I have an app that uses fragments. If I enable "dont keep activities", then enter the activity and enter the fragment, then minimize with the Home button and reopen the app the following behavior occurs - the app restores on the open fragment for about half a second, and immediately after that the fragment closes and the main activity for the application shows.

Do I need to perform some sort of restore state for the fragment manager for cases like this? Also, why is the fragment showing at all for half a second and then closing?

code for the MainActivity:

myFragment = (MyFragment) MyFragment.create(id);

            getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_in_right,     R.anim.slide_out_left, R.anim.slide_in_left, R.anim.slide_out_right)

                //.hide(getMainFragment())

                .add(R.id.content, MyFragment.create(id), MY_FRAGMENT_TAG)

                .addToBackStack(null)

                .commit();

        setDrawerIndicatorEnabled(false);


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md