我需要在我的 android 应用程序中为用户创建登录密码。第一部分比较 setPass 和确认通过,然后将其保存在数据库中。我的问题是 else 永远不会运行下面是我的代码...
savePass.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if(setPass.getText().toString()
!=conPass.getText().toString()){
Log.d("login", "Checking whether passwords created ok");
Log.d("login", "setPass: " + setPass.getText().toString());
Log.d("login", "conPass: " + conPass.getText().toString());
error.setText("Passwords do not match!");
}else{
Log.d("login", "showing dialog 0 ");
showDialog(0);
Log.d("login", "Instantiating loginNew");
Login login = new Login();
login.setPassword(setPass.toString());
Log.d("login", "Adding to db");
db.addPassword(login);
Log.d("login", "opening main login form");
Intent intent = new Intent("com.philsoft.budget.activity_main");
startActivity(intent);
}
}
});