Android Studio: How to Update Cell Values in SmartTable
To set a new cell value of a SmartTable in Android Studio, you need to follow these steps:
- Get the SmartTable instance and the position of the cell you want to modify.
SmartTable<MyModel> smartTable = findViewById(R.id.smart_table);
int row = 0;
int col = 1;
- Get the data model instance for the selected row.
MyModel model = smartTable.getTableData().get(row);
- Modify the value of the cell using the setter method of the corresponding field in the data model.
model.setMyField('New Value');
- Notify the adapter that the data has changed.
smartTable.notifyDataChanged();
Now the SmartTable will display the new value in the selected cell.
原文地址: https://www.cveoy.top/t/topic/mZzH 著作权归作者所有。请勿转载和采集!