Java tutorial
//package com.java2s; import android.widget.ListView; import java.util.List; public class Main { public static int getAllListViewSectionCounts(ListView lv, List dataSource) { if (null == lv || dataSource == null || dataSource.isEmpty()) { return 0; } return dataSource.size() + lv.getHeaderViewsCount() + lv.getFooterViewsCount(); } }