I have a ListView to which i have added a footer. What call can I make on the list view to determine if a given footer is currently added to the listview?
listView.findViewById(errorFooterid) ?
there does not seem to be a method
view.containsView(viewReference)
Checking if an existing view is contained by another seems like a basic operation, but I don't know if there is a reliable way to check this in android.
Why does the SDK not support a clear and simple way to check for this? Even findByView(R.id.viewId) and null check is not very elegant way to do boolean check.
If you had only one footer and want to know it's added or not, you would try to use
public int getFooterViewsCount ()
Since: API Level 1
Returns the number of footer views in the list. Footer views are special views at the bottom of the list that should not be recycled during a layout.
Returns
The number of footer views, 0 in the default implementation.
So if it return 0, your listview
doesn't have footer
yourListView.getFooterViewsCount();
You can find out the number of footer views by using the following code
listView.getFooterViewsCount();
If it returns 0, There is no footer views present.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With