当前位置: 首页 > 知识库问答 >
问题:

java.lang.Throwable: setStateLock

华善
2023-03-14

每次从其他活动意图到登录活动时,它都会使应用程序崩溃。

错误的日志:

AccessibilityManager: setStateLocked: waEn的=假,mIsEn的=假,waTouchExplorationEn的=假,mIsTouchExplorationEn的=假,waHighTextContrastEn的=假,mIsHighTextContrastEn的=假java.lang.抛出:setStateLocked在com.example.feoit.html" target="_blank">mapmanagement.LoginActivity.on创建(LoginActivity.java:63)

public class LoginActivity extends AppCompatActivity implements View.OnClickListener {

    EditText email, password;
    Button btnSignIn, forgotpwdbtn, btnRegister;
    private FirebaseAuth auth;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);


        email = (EditText) findViewById(R.id.email);
        password = (EditText) findViewById(R.id.password);

        btnSignIn = (Button) findViewById(R.id.btnSignIn);
        forgotpwdbtn = (Button) findViewById(R.id.forgotpwdbtn);
        btnRegister = (Button) findViewById(R.id.btnRegister);

        btnSignIn.setOnClickListener(this);
        forgotpwdbtn.setOnClickListener(this);
        btnRegister.setOnClickListener(this);

        auth = FirebaseAuth.getInstance();
    }



    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btnSignIn:
                String email1 = email.getText().toString().trim();
                String password1 = password.getText().toString().trim();
                auth.signInWithEmailAndPassword(email1, password1).addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {

                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {

                        if (task.isSuccessful()) {
                            Toast.makeText(LoginActivity.this, "Authentication success", Toast.LENGTH_SHORT).show();
                            Intent mainIntent = new Intent(LoginActivity.this, MapsTrack.class);
                            startActivity(mainIntent);

                        } else {
                            Toast.makeText(LoginActivity.this, "Authentication failed." + task.getException(), Toast.LENGTH_SHORT).show();
                        }
                    }
                });
                break;
            case R.id.forgotpwdbtn:
                Intent intent = new Intent(LoginActivity.this, ForgotPasswordActivity.class);
                startActivity(intent);
                break;
            case R.id.btnRegister:
                Intent intentreg = new Intent(LoginActivity.this, Register.class);
                startActivity(intentreg);
                break;


        }
    }
}

类的第 63 行是

setContentView(R.layout.activity_login);

完整日志目录错误:

AccessibilityManager:setStateLocked:was enabled = false,mIsEnabled = false,wastuchexplorationenabled = false,mIsTouchExplorationEnabled = false,washthitextcontrastenabled = false,misthightextcontrastenabled = false Java . lang . throwable:setStateLocked at Android . view . AccessibilityManager . setStateLocked(accessibilititymanager . Java:553)at Android . view . AccessibilityManager . tryconnecttoservicelocked(AccessibilityManager(PhoneWindow.java:2330)at com . Android . internal . policy . impl . phone window . generate decor(phone window . Java:3471)at com . Android . internal . policy . impl . phone window . install decor(phone window . Java:3857)at com . Android . internal . policy . impl . phone window . getdecor view(phone window . Java:2046)at Android . support . V7 . app . appcompatdelegateimplv 9 . createsubdecor(appcompatdelegateimplv 9 . Java:367)at

共有2个答案

燕禄
2023-03-14

这可能是您尝试从mainActivity调用登录活动的意图的方式,或者您尝试创建我通常使用的意图的方式

Intent i = new Intent(this, Page2.class); // Change to LoginActivity.class
i.putExtra("isNewUser","true"); // Optional 
startActivity(i);

您可能已经在这样做了,我不确定,因为不包括您调用此类的代码。

此外,您应该在开关语句中添加一个默认大小写,它可以防止以后出现棘手的错误。

通寂离
2023-03-14

显然,我已经找到了我的解决方案。我错过了一个活动中的super.onStop(),这对我来说很粗心。道歉并感谢您的所有时间!

 类似资料:

相关问答

相关文章

相关阅读