我尝试将ab EditText值转换为字符串,但我没有得到预期结果:它显示为null ...
EditText editsignUpUserName = (EditText)findViewById(R.id.editSignUpUserName);
String uName = editsignUpUserName.getText().toString();
答案 0 :(得分:0)
我清除它,我做的错误在编辑文本之前将其转换为字符串甚至从用户获得输入...完整的代码如下:
EditText editsignUpUserName = (EditText) findViewById(R.id.editUserName);
signup = (Button) findViewById(R.id.signup);
signup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String s= editsignUpUserName.getText().toString();
}