pakerfeldt / android-viewflow

A horizontal view scroller library for Android
1.78k stars 694 forks source link

getSelectedView returns null instead of the correct view #10

Closed jspeth closed 13 years ago

jspeth commented 13 years ago

getSelectedView checks the mCurrentAdapterIndex against the length of mLoadedViews. This will be false for positions greater than the loaded views, so it will return null.

I'm pretty sure that it should be checking mCurrentBufferIndex instead, so getSelectedView should be:

    public View getSelectedView() {
        return (mCurrentBufferIndex < mLoadedViews.size() ? mLoadedViews
                .get(mCurrentBufferIndex) : null);
    }

Sorry, I'm just getting used to github, so haven't properly contributed this.