I have a list (of messages) and I want to give the user the ability to remove these items from the list. I have extended an ArrayAdapter
and give it an ArrayList
of my messages and would like to simply remove an item from that list and then refresh the ListView
instead of reloading the entire list of sent messages. The problem is, if there's only one message and I remove it using listAdapter.remove(messageObject)
, the adapter is still calling getView()
and then throwing NullPointerExceptions
all over the place. I'm not sure what the best way is to go about this.
Apparently things go a little haywire if you don't override the getCount() function in your custom ArrayAdapter. I set it to the size of my ArrayList and now everything seems to be working correctly.
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