Most likely you encountered this exception
ClassCastException: LinearLayout$LayoutParams Cannot Be Cast to AbsListView$LayoutParams
because you either added a header and/or footer in the ListView component and when you removed them, you found out there was no error generated.
Explanations aside, to fix this problem just set the LayoutParams of your header or footer like this:
footerview.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
That should solve it.