I made an onTouchListener to a list view that checks which item (string in my case) in that list was clicked and it’s position. I want to take out that string of the list, so I made a method that gets the array adpter’s string array and the poistion the list was touched and returns a new array that is the same but without the string that was touched. now I want to update the list view adapter to the new array, how do I do that?
thanks
I made an onTouchListener to a list view that checks which item (string in
Share
What you have to do is set a change notification to the array adapter via the BaseAdapter.notifyDatasetChanged.
This will refresh the entire list view. Note: this must be called in the main thread.
EDIT:
To clear some confusion you have to first fetch the Adapter from your list view. This is done by calling myListView.getAdapter(). So you could do