ListView no longer reacts to onclick after a call to setSelection()
In Zwitscher I have a ListView
that displays a number of tweets. The user can then reload the timeline and if there are new tweets, the new list is loaded into the list adapter (plus some old ones) and I scroll to the end of the list via
listView.setSelection(x);
where x
is the number of the oldest tweets of the freshly loaded ones. This works very well.
But unfortunately this "disables" the onItemClick()
and onItemLongClick()
handlers on the view开发者_高级运维. If I then (e.g. from a button) call
listView.setSelection(0);
The handlers for onItemClick()
and onItemLongClick()
are "enabled" again.
I've verified that the handlers are still set on the listView after the call to setSelection(x)
. And disabling that call to setSelection(x)
also does not "disable" the handlers.
Any idea what I am doing wrong?
The full source is here: https://github.com/pilhuhn/ZwitscherA/blob/master/src/de/bsd/zwitscher/TweetListActivity.java and the lines in question are in onPostExecute()
on line 417
I could not reproduce that. onItemClick()
is called after any setSelection
. Try to isolate the problem down by creating a test case that reproduces. If you succeed, I thing you should submit a bug to android.
精彩评论