我已经看到了其他post,但最常见的答案仅适用于清单文件中定义的TextView
,这不是我的情况。我正在使用DialogAlert
对象来请求一个String,它只能是字母数字。
[UPDATE]
final EditText input = new EditText(MainActivityS.this);
setUserIdAlertDialog.setView(input);
setUserIdAlertDialog.setPositiveButton(getString(R.string.yesLabel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String value = input.getText().toString();
Utils.sendStringIntent(getBaseContext(), getString(R.string.ACTION_ACTIVITY_NEW_ID), "ACTIVITY", value, getString(R.string.INTENT_EXTRA_NEW_USERNAME));
}
});
setUserIdAlertDialog.setNegativeButton(getString(R.string.noLabel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
setUserIdAlertDialog.show();