我是Android的新手,我被困在一个似乎是一个简单的问题修复,但我只是不知道我做错了什么!我需要做的只是注册一个用户,由于某种原因,e永远不会等于null,因此它会直接进入else部分,这会给我无效的会话令牌消息.这是注册部分的代码,我看了几千次!:
protected EditText mUsername;
protected EditText mPassword;
protected EditText mEmail;
protected Button mSignUpButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up_manager);
mUsername = (EditText)findViewById(R.id.usernameField);
mPassword = (EditText)findViewById(R.id.passwordField);
mEmail = (EditText)findViewById(R.id.emailField);
mSignUpButton = (Button)findViewById(R.id.signupButton);
mSignUpButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String username = mUsername.getText().toString();
String password = mPassword.getText().toString();
String email = mEmail.getText().toString();
//trims the spaces
username = username.trim();
password = password.trim();
email = email.trim();
//if one of the text edits is empty send them a message with a …Run Code Online (Sandbox Code Playgroud)