regsCode1=objCommonServices.fetchRegisterationCode(etMobileNo.getText().toString().trim(),etPassword.getText().toString().trim());
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Recharhge Confirmation");
alert.setMessage("Message");
// Set an EditText view to get user input
final EditText input = new EditText(this);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Editable value = input.getText();
System.out.println("Hello"+regsCode1 +" Value is "+value.toString());
if(value.toString().equals(regsCode1)){
System.out.println("Hello"+regsCode1+" "+value);
}
else{
System.out.println("B");
}
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alert.show();
我得到了结果 B。由于 System.out 正确打印了两个值,但它不比较两个字符串,我什至从 String 值更改了 Editable 值并使用了对象类的 toString fn。但我也无法比较两个值