android - Count Total Number of List Items in a ListView -


how count total number of list items in listview ?

i writing church application in populating list using images stored sd card, want count total number of list items.

     // upload whole list      for(int position = 0; position < lstview.getadapter().getcount(); position++)                  {                      flags.put(position, true);                     }                   ((baseadapter) lstview.getadapter()).notifydatasetchanged();                     }         });          /*** images sdcard ***/         listsdcardimages = fetchsdcardimages();          // listview , imageadapter         lstview = (listview) findviewbyid(r.id.listsdcardimages);         lstview.setadapter(new listsdcardimagesadapter(this));          toast.maketext(getapplicationcontext(), "total number of items are:" + string.valueof(position), toast.length_long).show();         } 

everytime getting 0

total list view count

 lstview.getadapter().getcount() , 

so use

toast.maketext(getapplicationcontext(), "total number of items are:" + lstview.getadapter().getcount() , toast.length_long).show(); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -