是否可以在已设置的 edittext 中更新文本?我已经用我的列表视图中的一个人的姓名和电话号码填写了我的编辑文本,我希望用户编辑这些详细信息。当我尝试输入例如姓氏并单击更新按钮时,它无法保存我的输入,但仍然保存了我从列表视图中传递的那个。
EditText sqlName = (EditText)findViewById(R.id.editName);
EditText sqlNumber = (EditText)findViewById(R.id.editNumber);
name = CustomListView.name;
num = CustomListView.number;
Button bUpdate = (Button)findViewById(R.id.editUpdate);
Button bView = (Button)findViewById(R.id.editView);
sqlName.setText(name);
sqlNumber.setText(num);
nameChanged = sqlName.getText().toString();
numChanged = sqlNumber.getText().toString();
bUpdate.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
GroupDb info = new GroupDb(EditDetails.this);
info.open();
long rowid = info.getRowId(name, num);
Toast.makeText(getApplicationContext(), nameChanged+" "+numChanged+" ", Toast.LENGTH_LONG).show();
info.updateNameNumber(rowid, nameChanged, numChanged);
Toast.makeText(getApplicationContext(), "Update Successful!", Toast.LENGTH_LONG).show();
info.close();
}
});