Saturday, 15 May 2010

android - ListFragment's setListShown method not working -



android - ListFragment's setListShown method not working -

i'm using listfragment parsequeryadapter in order show list of leagues (custom model). managed desired state except loading animation not showing @ all.

it seems animation hidden when listsadapter set (by setlistadapter method), set adapter after list fetched, parsequeryadapter fetches list after setting adapter list.

so found can utilize setlistshown method in order hide/show animation, in current implementation doesn't work.

my code:

public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); sethasoptionsmenu(true); // create query mill parsequeryadapter.queryfactory<league> mill = new parsequeryadapter.queryfactory<league>() { public parsequery<league> create() { parsequery<league> query = league.getquery(); query.whereequalto(league.field_user, parseuser.getcurrentuser()); query.orderbydescending(league.field_created_at); homecoming query; } }; // create adapter leaguelistadapter = new leagueadapter(getactivity(), factory); // loading listener leaguelistadapter.addonqueryloadlistener(new parsequeryadapter.onqueryloadlistener<league>() { @override public void onloading() { // show listfragment's loading animation while loading setlistshown(false); } @override public void onloaded(list<league> leagues, exception e) { if(e == null){ // hide loading animation , show list setlistshown(true); // set leagues in cache leaguescache.getinstance().setcachedleagues(leagues); } else { toast.maketext(getactivity(), e.getmessage(), toast.length_long).show(); } } }); // set fragment's adapter setlistadapter(leaguelistadapter); // dialogs addleaguedialog = new addleaguedialog(this); }

android parse.com android-listfragment android-parsequeryadapter

No comments:

Post a Comment