我在android工作室做一个java项目。我做了一个用户登录页面。我希望它在输入用户名后重定向到主页,但是我得到一个类似w/system的警告:忽略标题x-firebase-locale,因为它的值为null。模拟器的wifi也打开了。
在firebase身份验证部分,用户有权使用电子邮件和密码注册。
代码:
public MainActivity() {
}
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btngiris=(Button)findViewById(R.id.button);
Button btnkayit=(Button)findViewById(R.id.kayit);
girisyetkisi=FirebaseAuth.getInstance();
txtadi=findViewById(R.id.txtadi);
txtemaili=findViewById(R.id.txtemaili);
txtsifresi=findViewById(R.id.txtsifresi);
btnkayit.setOnClickListener(v -> {
Intent intent= new Intent(MainActivity.this,kayitol.class);
startActivity(intent);
finish();
});
btngiris.setOnClickListener( v -> {
String str_ad = txtadi.getText().toString();
String str_email=txtemaili.getText().toString();
String str_sifre=txtsifresi.getText().toString();
if(TextUtils.isEmpty(str_ad )){
Toast.makeText(MainActivity.this,"İsim girilmesi gerekir",Toast.LENGTH_LONG).show();
}
else if(TextUtils.isEmpty(str_email)) {
Toast.makeText(MainActivity.this, "Email girilmesi gerekir", Toast.LENGTH_LONG).show();
}
else if (TextUtils.isEmpty(str_sifre)){
Toast.makeText(MainActivity.this,"Şifre girilmesi gerekir",Toast.LENGTH_LONG).show();
}
else{
girisyetkisi.signInWithEmailAndPassword(str_email,str_sifre).addOnCompleteListener(MainActivity.this, task -> {
if(task.isSuccessful()){
DatabaseReference yolGiris= FirebaseDatabase.getInstance().getReference().child("Kullanıcılar").child(girisyetkisi.getCurrentUser().getUid());
yolGiris.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Intent intent=new Intent(MainActivity.this,MenusayfasiActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
else{
Toast.makeText(MainActivity.this,"Giriş başarısız",Toast.LENGTH_LONG).show();
}
});
}
});
}
1条答案
按热度按时间ssm49v7z1#
依赖关系{实现平台('com.google)。firebase:firebase-bom:25.12.0')