我想点击删除按钮,然后刷新我的ListView及其中的数据,但没有任何反应......在我回到MainActivity并用它开始我的新活动后,ListView刷新。
@Override
public void onClick(View v) {
int position = (Integer) v.getTag();
Object object = getItem(position);
DataModel dataModel = (DataModel) object;
switch (v.getId()) {
case R.id.item_info:
String selection = Base.BaseEntry.CONNECTION_NAME + " LIKE ?";
String[] selectionArgs = { dataModel.getCONNECTION_NAME() };
db.delete(Base.BaseEntry.TABLE_NAME, selection, selectionArgs);
this.notifyDataSetChanged();
Snackbar.make(v, "Connection: '" + dataModel.getCONNECTION_NAME() + "' has been deleted", Snackbar.LENGTH_LONG)
.setAction("No action", null).show();
break;
}
}