Answer the question
In order to leave comments, you need to log in
How to track the change in the number of items in a ListView?
The fragment has a ListView and elements after it (buttons), the data is taken from the adapter. The adapter can add/remove data to the ListView.
Changes are tracked via notifyDataSetChanged() and the ListView updates fine.
The problem is that the fragment is in a ScrollView, because you need to be able to scroll the entire ListView and the buttons after it. The height of the ListView is set programmatically (number of items * height of the item).
But if the ListView is updated, then you need to track this change and re-adjust the height of the ListView (new number of items * item height). How do you know that the ListView has changed?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question