Remove all added views from ListView

I am adding a view to my ListView with the following code:

((ViewGroup) myListView.getParent()).addView(createMyCustomView());

My question is how to clear all the added views? I've tried removeAllViews() but it's not working.

I need to add the view to my ListView so that I can set its empty view with:

myListView.setEmptyView(createMyCustomView());

Answers


Clear the items from the list you are using in your adapter, then call notifyDataSetChanged() on the adapter. Checkout this similar question.

Let me know if this helps, or if you need more information!


Need Your Help

Performance of F# code terrible

performance recursion f# sequences

This is my very first F# programme. I thought I would implement Conway's Game of Life as a first exercise.

Should I use curly brackets or concatenate variables within strings?

php concatenation curly-braces

Straight forward question: Is there an advantage or disadvantage to concatenating variables within strings or using curly braces instead?