我正在尝试更改我的代码。但是,它失败了。我的输出还是一样。也就是说,如果用户放置了一个已经存在或不存在的电子邮件。验证“此电子邮件已被注册。” 还是出来了。为什么?有人我的编码有什么问题吗?
这是我的方法:-
public boolean isCheckEmail(final String email)
{
mAuth.fetchProvidersForEmail(email).addOnCompleteListener(new OnCompleteListener<ProviderQueryResult>()
{
@Override
public void onComplete(@NonNull Task<ProviderQueryResult> task)
{
boolean check = !task.getResult().getProviders().isEmpty();
if(check)
{
Toast.makeText(Signup.this, "This email has been registered.", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(Signup.this, "This email has been registered.", Toast.LENGTH_SHORT).show();
}
}
});
return true;
}
虽然这半编码,我试图回调方法 isCheckEmail:-
private void RegisterAccount(String firstname, String lastname, String email, String password, String confirmpass)
{
if (TextUtils.isEmpty(email))
{
Toast.makeText(Signup.this, "Enter your email address.", Toast.LENGTH_SHORT).show();
}
else if (!isValidEmail(email)) {
Toast.makeText(Signup.this,"Please enter your valid email address.",Toast.LENGTH_SHORT).show();
}
else if (!isCheckEmail(email))
{
Toast.makeText(Signup.this, "This email has been registered.", Toast.LENGTH_SHORT).show();
}
慕尼黑的夜晚无繁华
手掌心
相关分类