i'm working listfragments .. want use setemptytext() when list empty doesn't show keep displaying progress keeps displaying progress bar don't know layout contains list , here's code
@override public void onactivitycreated(bundle savedinstancestate) { // todo auto-generated method stub super.onactivitycreated(savedinstancestate); new getdata().execute(); } private class getdata extends asynctask<void, void, arraylist<object>> { @override protected arraylist<object> doinbackground(void... params) { // todo auto-generated method stub try { artists = new arraylist<object>(); artists = loadartists("taqwa.xml"); return loadxml("taqwa.xml"); } catch (xmlpullparserexception e) { e.printstacktrace(); utils.log("xml exception", "true"); return null; } catch (ioexception e) { e.printstacktrace(); utils.log("ioexception", "true"); return null; } } @override protected void onpostexecute(arraylist<object> result) { // todo auto-generated method stub super.onpostexecute(result); if (result != null) { listadapter ladapter = new listadapter(getactivity(), r.layout.list_row, null, artists, 3); setlistadapter(ladapter); } else { setemptytext("not found wallahi!"); } } }
as can see don't use layout contains @id/android:list add @id/android:empty .. send the list item baseadapter
looks don't have adapter list view, setemptytext() doesn't work.
Comments
Post a Comment