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

Crash while switching rows using the adapter which subcalsses BaseDataAdaptiveTableLayoutAdapter #20

Closed
hao33782 opened this issue Nov 22, 2017 · 1 comment
Labels

Comments

@hao33782
Copy link

My code is as follows.

static class MyAdapter extends
        BaseDataAdaptiveTableLayoutAdapter<MyAdapter.ViewHolder> {
    @Override
    protected Object[][] getItems() {
        return cells;
    }

    @Override
    public void onBindViewHolder(ViewHolder viewHolder, int row, int column) {
        viewHolder.text.setText(cells[row][column]);
    }

    // other codes...
}

It works well when dragging is not involved.
When switching columns, the app doesn't crash.
But if rows are switched, it crashes!

I found the following code in the library:

void switchTwoRows(int rowIndex, int rowToIndex) {
    for (int i = 0; i < getItems().length; i++) {
        Object cellData = getItems()[rowToIndex][i];
        getItems()[rowToIndex][i] = getItems()[rowIndex][i];
        getItems()[rowIndex][i] = cellData;
    }
}

I think getItems().length should not be used here. It just gives number of rows of my data...
It should be something like getColumnCount() - 1.
Is it my misunderstanding?
Any comment is appreciate.

@yarovoiag yarovoiag added the bug label Jan 4, 2019
@VadimHalimendikCr
Copy link
Collaborator

HI, we cannot reproduce this bug. You can give us more information?

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

No branches or pull requests

3 participants