What I want to achieve is having a ListFragment which displays data loaded from an external source. I want to use the Android 3.0 SDK for this purpose and come as close to the native user experience as possible.
In fact everything works fine, I am calling getLoaderManager().initLoader(0, null, this)
in onActivityCreated()
of the ListFragment.
I implemented onCreateLoader, onLoadFinished and onLoaderReset as well but the problem is that even though onLoadFinished is called and I get all the results the loader stays and will not go away.
I tried calling loader.abandon()
, loader.stopLoading()
and getLoaderManager().destroyLoader(0)
.However the loader is still actively visible and displaying its animation.
The problem I had is also that all examples are only working with a CursorLoader and maybe I missunderstood the whole idea of having a loader here. In fact I al开发者_运维百科so had to write my own Loader implementation which extends AsyncLoaderTask but it is mostly identical to what CursorLoader does.
So maybe there is something else suited better for this task? To be honest I have absolutely no clue about Android development :)
Probelm is I was calling getListView().setAdapter(...) instead of setListAdapter(...).
精彩评论