KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm having a strange problem with my app - A have a Fragment Activity which contains a fragment - This fragment starts an AsyncTask onCreate() and cancels the AsyncTask onStop(). My problem arises because, although my Fragment stays running & isn't obscured it's onStop() is called almost directly after it's onCreate(). Does anyone know how to trace why this would be happening? 09-28 11:41:56.785: VERBOSE/SearchFragment1(924): onCreate() 09-28 11:41:56.796: VERBOSE/SearchFragment1(924): onStop() EDIT I've removed the code from the Fragment and I'm still absolutely baffled - The problem persists! I've added a few more lines of logging: 09-28 14:09:00.242: VERBOSE/SearchResultsFragment1(1789): onAttach() 09-28 14:09:00.242: VERBOSE/SearchResultsFragment1(1789): onCreate() 09-28 14:09:00.242: VERBOSE/SearchResultsFragment1(1789): onCreateView() 09-28 14:09:00.242: VERBOSE/SearchResultsFragment1(1789): onActivityCreated() 09-28 14:09:00.242: VERBOSE/SearchResultsFragment1(1789): onStart() 09-28 14:09:00.246: VERBOSE/SearchResultsFragment1(1789): onStop() 09-28 14:09:00.246: VERBOSE/SearchResultsFragment1(1789): onStart() 09-28 14:09:00.246: VERBOSE/SearchResultsFragment1(1789): onResume() The above behaviour is... baffling. The code used in the Activity looks like this: if(savedInstanceState == null) { try { FragmentTransaction transaction= getSupportFragmentManager().beginTransaction(); Fragment currentFragment= (Fragment)Class.forName(getIntent().getAction()).newInstance(); transaction.replace(R.id.singlePane, currentFragment); transaction.commit(); } catch ... This is the Fragment as it stands during debug: private static final boolean LOGGING_ENABLED = true; private static int global_creation_count = 0; private int local_count = global_creation_count; @Over
Tags (comma-separated)
Save Edits
Cancel