I want to save these methods:
setListShown(true);
setListShownNoAnimation(true);
but if i use
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
to inflate Fragmentwith a special style, the previous methods cannot be used and show this exception:
07-30 20:17:46.937: E/AndroidRuntime(1374): Caused by: java.lang.IllegalStateException: Can't be used with a custom content view
07-30 20:17:46.937: E/AndroidRuntime(1374): at android.support.v4.app.ListFragment.setListShown(ListFragment.java:282)
07-30 20:17:46.937: E/AndroidRuntime(1374): at android.support.v4.app.ListFragment.setListShown(ListFragment.java:258)
So what is the possible solution?
EDIT:
Fragmentuses the bootloader to populate its own ListViewfrom the database. Therefore, why I want to save these methods, they are needed here:
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
mAdapter.swapCursor(data);
if (isResumed()) {
setListShown(true);
} else {
setListShownNoAnimation(true);
}
}
The easiest solution is to make my own code based on the source ListFragment, and also add a progress widget to the layout to show the same effect. By now, I will delete these lines as I was told. If I make a modification, I will put it here.
source
share