How to disable the back button after starting startActivityForResult in FirebaseUI?

I know that if I use the onBackPressed method, the return button is disabled, but my question is how and where should I use it if I have .createSignInIntentBuilder () in my activity. This is like creating a new activity without a java class.

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

    auth = FirebaseAuth.getInstance();
    if (auth.getCurrentUser() == null) {

        startActivityForResult(AuthUI.getInstance()
                .createSignInIntentBuilder()
                .setIsSmartLockEnabled(false)
                .setProviders(AuthUI.GOOGLE_PROVIDER, AuthUI.FACEBOOK_PROVIDER, AuthUI.EMAIL_PROVIDER)
                .build(), RC_SIGN_IN);
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == RC_SIGN_IN) {
        if (resultCode == RESULT_OK) {
            Intent i = new Intent(getApplicationContext(), LoggedIn.class);
            startActivity(i);
            finish();
        } else {
            Log.i(TAG, "LogIn.class : Something is wrong with requestCode");
        }
    }
}
+4
source share

Source: https://habr.com/ru/post/1656976/


All Articles