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

throw exception if position is invalid in getView #22

Open
yishai-glide opened this issue Dec 9, 2015 · 0 comments
Open

throw exception if position is invalid in getView #22

yishai-glide opened this issue Dec 9, 2015 · 0 comments

Comments

@yishai-glide
Copy link

if due to stupidity of programmer the adapter is requesting a view to be displayed in an invalid position i.e. position > getCount() == true the method returns null and passes the issue to other places in the system

In my case, there was a location in which I forgot to call notifyDatasetInvalidated() when the adapter cleared the data and scrolling in the invalid list wold cause an issue in android.widget.HeaderViewListAdapter.isEnabled instead of throwing it in the initial getView.

I suggest adding a validation of position and an exception instead of returning null and letting the system crash.

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

No branches or pull requests

2 participants