This workaround may not be the best method to solve this problem, but it works just fine:
What I did was to first make the Fragment not display at all when I declared it in the layout.xml file:
<fragment class="com.example.MyListFragment" android:id="@+id/frag_list" android:layout_width="0dp" android:layout_height="match_parent" android:visibility="gone" />
Then, after the data has been loaded and processed, I would then display the Fragment using FragmentTransaction:
FragmentManager fm = getFragmentManager(); Fragment frag = fm.findFragmentById(R.id.frag_list); FragmentTransaction ft = fm.beginTransaction(); ft.show(frag); ft.commit();
If there is a better way to solve this problem, I am open to suggestions.
fayerth
source share