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.
My code is as follows.
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:
I think
getItems().length
should not be used here. It just gives number of rows of my data... It should be something likegetColumnCount() - 1
. Is it my misunderstanding? Any comment is appreciate.