Button to open a new activity is returning to the initial activity

-1

In my application I made a login screen and put a button to authenticate the user through Facebook, after login comes the main screen and in this screen has a button that calls a new Activity. So far so good. Now the problem is, I put a button on the login screen to authenticate the user by Google, it logs and opens the main screen, the same as the login with Facebook, but when I click the button to open the new Activity instead of opening the new screen is returning to login screen

MainActivity Button Code

  Button Config= (Button) findViewById(R.id.Config);
            PerfilButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    startActivity(new Intent(MainActivity.this,Config.class));

                }
            });

Code to open the main Activity

private void goMainScreen() {
    Intent intent = new Intent(this, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
}

This goMainScreen () is used to call the main screen after the user logs in to Google

When logging in with Facebook everything works fine, but logging in with Google gives you trouble clicking the button to open the new Activity.

I think the error may be on the button, but I do not understand why it works fine when logging in with Facebook but not with Google, if the two logging modes open the same screen

    
asked by anonymous 15.04.2017 / 20:50

1 answer

0

Try this way

Button Config= (Button) findViewById(R.id.Config);
    PerfilButton.setOnClickListener(new View.OnClickListener() {
    @Override
        public void onClick(View v) {
            Intent i = new Intent(MainActivity.this, Config.class)
            startActivity(i);

        }
    });
    
15.04.2017 / 22:44