android - AlertDialog.Builder 重置密码按钮不起作用.Android Studio
问题描述
我正在尝试创建 AlertDialogBox 以使用按钮重置密码。但是按钮不起作用。
reset_pwd.setOnClickListener(v -> {
EditText resetPassword = new EditText(v.getContext());
AlertDialog.Builder reset_pwd = new AlertDialog.Builder(v.getContext());
reset_pwd.setTitle("Reset Password");
reset_pwd.setMessage("Enter new password > 6 characters long numeric only.");
reset_pwd.setView(resetPassword);
reset_pwd.setPositiveButton("Yes", (dialog, which) -> {
String newPassword = resetPassword.getText().toString();
user.updatePassword(newPassword).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(MyAccountActivity.this, "Password Reset Successfully.", Toast.LENGTH_SHORT).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(MyAccountActivity.this,"Password Reset Failed", Toast.LENGTH_SHORT).show();
}
});
});
reset_pwd.setNegativeButton("No", (dialog, which) -> {
});
});
解决方案
推荐阅读
- javascript - href="javascript:void(0)" bbcode 链接但保持可链接
- javascript - React Redux 存储更改有时会重新呈现,有时不会
- javascript - 我需要执行 javascript 语句,每次递增一个变量(90 次)
- angular - 如何将锚标记添加到 ngx-datatable-column
- reactjs - 应用程序创建 w create-react-app-ts 缺少引导 css
- javascript - Webassembly 最终会在浏览器中呈现为 HTML 吗?
- python - 使用 numpy 对特定范围内的数组值求和
- asp.net - Asp.net WebAPI - 强制使用 HTTPS?
- repository - bitbucket 在一台计算机上,但在另一台计算机上还可以
- c# - 有条件地加入 2 个列表的子列表