在火力地堡验证是没有启动HomeActivitiy按钮点击。它仅在重新打开应用程序时有效。public class Auth1Activity extends AppCompatActivity { String string_1; String string_2; private static final Boolean CHECK_EMAIL_VERIFIED = false; private static final String TAG = "LoginActivity"; private FirebaseAuth firebaseAuth; private FirebaseAuth.AuthStateListener authStateListener; private FirebaseUser firebaseUser; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_auth_1); firebaseAuth = FirebaseAuth.getInstance(); authStateListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { } }; firebaseUser = firebaseAuth.getCurrentUser(); if (firebaseUser != null) { Intent intent = new Intent(Auth1Activity.this, HomeActivity.class); startActivity(intent); finish(); } final EditText auth_layout_1_edit_text_1 = findViewById(R.id.auth_layout_1_edit_text_1); final EditText auth_layout_1_edit_text_2 = findViewById(R.id.auth_layout_1_edit_text_2); Button auth_layout_1_button = findViewById(R.id.auth_layout_1_button); auth_layout_1_button.setOnClickListener(new View.OnClickListener() {可能出什么问题了?
1 回答
繁星点点滴滴
TA贡献1803条经验 获得超3个赞
试试这个方法
authStateListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
firebaseUser = firebaseAuth.getCurrentUser();
if (firebaseUser != null) {
Intent intent = new Intent(Auth1Activity.this, HomeActivity.class);
startActivity(intent);
finish();
}
}
};
添加回答
举报
0/150
提交
取消