Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question and bug: making "notifyDataSetChanged" stay on same place #3

Open
AndroidDeveloperLB opened this issue Nov 26, 2017 · 1 comment

Comments

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Nov 26, 2017

I've noticed that whether you scroll to the top or to the bottom, after it finishes loading, you call notifyDataSetChanged , but the scrolling stay almost on same place, almost perfectly.

How did you do this?

I've written about it here:
https://stackoverflow.com/q/47458429/878126

Also, found an issue about this.
If I let it load, and then I scroll a bit, it doesn't stay on the current place.
Attached video to show issue.
device-2017-11-26-114106.zip

@AndroidDeveloperLB AndroidDeveloperLB changed the title Question: how did you make the "notifyDataSetChanged" stay on same place? Question and bug: making "notifyDataSetChanged" stay on same place Nov 26, 2017
@AndroidDeveloperLB
Copy link
Author

Seems you call setSelection right after updating the data, in scrollToCurrentDate function.

This works, but:

  1. it doesn't take into account the amount of scrolling. That's probably the reason for the bug I've mentioned.
  2. it uses a linear check of the dates. You could have chosen binary search instead.
  3. Why do you call post ? Seems to work fine without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant