title: Google sign in,when i close my app it again shows Google Sign in page
body: <p>MainActivity</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks ,GoogleApiClient.OnConnectionFailedListener,View.OnClickListener {
  
      private SignInButton signInButton;
      private GoogleApiClient googleApiClient;
      public static final String TAG="MainActivity";
      private static final int RC_SIGN_IN=1;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          GoogleSignInOptions googleSignInOptions=new GoogleSignInOptions
                  .Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build();
  
          googleApiClient=new GoogleApiClient.Builder(this).enableAutoManage(this,this)
                  .addApi(Auth.GOOGLE_SIGN_IN_API,googleSignInOptions).build();
          signInButton=(SignInButton)findViewById(R.id.mainactivitygooglesigninbutton);
          signInButton.setOnClickListener(this);
  
  
  
      }
  
      @Override
      public void onClick(View v) {
          switch (v.getId()){
              case R.id.mainactivitygooglesigninbutton:
                  signIn();
                  break;
          }
      }
  
      private void signIn() {
          Intent intent=Auth.GoogleSignInApi.getSignInIntent(googleApiClient);
          startActivityForResult(intent,RC_SIGN_IN);
      }
  
  
      @Override
      public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
          Toast.makeText(getApplicationContext(), "Login Failed", Toast.LENGTH_SHORT).show();
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if(requestCode==RC_SIGN_IN){
              GoogleSignInResult result=Auth.GoogleSignInApi.getSignInResultFromIntent(data);
              handleSignInResult(result);
          }
      }
  
      private void handleSignInResult(GoogleSignInResult result) {
          if(result.isSuccess()){
              GoogleSignInAccount account=result.getSignInAccount();
              Intent intent=new Intent(this,ContactsActivity.class);
              startActivity(intent);
              finish();
          }
      }
  
  
      @Override
      public void onConnected(@Nullable Bundle bundle) {
          if (googleApiClient != null &amp;&amp; googleApiClient.isConnected()) {
              Intent intent=new Intent(this,ContactsActivity.class);
              startActivity(intent);
              finish();
          }
      }
  
      @Override
      public void onConnectionSuspended(int i) {
  
      }
  }
  </code></pre>
  
  <p>My MainActivity has the signin Option
  When i open my app and sign in it takes me to ContactsActivity.Now when i close my app and start again it shows me MainActivity again but i want to display ContactsActivity directly.Once user has successfully signed in and if he closes the app then i want to display ContactsActivity directly
  Please help.</p>