I got a ListActivity.
I update the activity using onContentChanged() API.
My problem is that each time I call the above API the list scrolls to the top. Is there any easy way to turn this “feature” off?
Thanks.
/ Henrik
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Activity#onContentChangedis not for ‘updating’ the data for the activity. It is called when the content view of the activity changes, i.e., whenActivity#setContentViewis called. TheListActivitywill reinitialize it’s content view when it receivesonContentChanged.The answer is, you’re doing it wrong, don’t use
onContentChangedthe way you are using it. That is why you are seeing this unexpected behavior. Use another method to update theListView, most probably by callingnotifyDataSetChangedfrom yourAdapter.