So I have been working on a little project of my own, The problem I am facing is It is working but the startActivity is executing before the signIn() method is done executing, i.e, after completing the activity I am getting a popup for selection of the Email account.
@Override
public void onClick(View v) {
if (v.getId() == R.id.sign_in_button) {
signIn();
}
startActivity(new Intent(LoginActivity.this, MainActivity.class));
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left);
finish();
}
private void signIn() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
}
And, the app is not working when the internet is not available, how do I make it to work? It crashes with the message "Unfortunately App has stopped."