I want to use getLastVisiblePosition() and apparently it is not giving me the right number after this method (notifyDataSetChanged) has been called. I think this method only not
Yes, if you run notifyDatasetChanged(), you need to queue the operation in the post because the view is rendered asynchronously:
notifyDatasetChanged()
post
listView.post(new Runnable() { public void run(){ lastPos = listView.getLastVisiblePosition(); } });