/** * 保存数据 * * @param v 视图 */ public void saveData(View v) { String userString = mUserET.getText().toString().trim(); User mUser = new User(); if (userString.equals("")) { return; } mUser.setName(userString); mUser.setRole(currentRole); for (int i = 0; i < mUsers.size(); i++) { if (userString.equals(mUsers.get(i).getName())) { mUsers.remove(i); } } mUsers.add(mUser); getUser(); mAdapter.notifyDataSetChanged(); }