In my project, I met a problem. I want to use the "Google API" to log in to LoginActivity. And exit another activity (called WelcomeActivity)
LoginActivity: (code here )
public class LoginActivity extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener, View.OnClickListener {
And I want to use the Sign_out Method in my greeting activity,
private void signOut() { // Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback( // new ResultCallback<Status>() { // @Override // public void onResult(Status status) { // // [START_EXCLUDE] //// updateUI(false); // // [END_EXCLUDE] // } // }); // }
To solve this problem, I will try 2 methods:
make mGoogleApiClient as a global variable (extends the application or Singleton), I try but failed, on the welcome page mGoogleApiClient is not null, but error: mGoogleApiClient is not connected yet .
I call LoginActivity.getMGoogleApiClient (static variable) but also failed, same error: mGoogleApiClient is not connected yet .
I have been looking for this problem for several days, but nothing useful to solve it, please help me.
source share