title: My application get crashed
body: <p>My splash activity code is:</p>
  
  <pre><code>package com.example.hp_pc.earnmebucks;
  
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.animation.Animation;
  import android.view.animation.AnimationUtils;
  import android.widget.ImageView;
  import android.widget.LinearLayout;
  
  public class SplashActivity extends AppCompatActivity {
      Thread splashTread;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_splash);
          Thread timerThread = new Thread() {
              public void run() {
                  try {
                      sleep(3000);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  } finally {
                      Intent intent = new Intent(SplashActivity.this, Login.class);
                      startActivity(intent);
                  }
              }
          };
          timerThread.start();
      }
  }
  </code></pre>
  
  <p>My Login.java code is :</p>
  
  <pre><code>package com.example.hp_pc.earnmebucks;
  
  import android.app.Activity;
  import android.app.ProgressDialog;
  import android.content.Intent;
  import android.support.annotation.NonNull;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Button;
  import android.widget.ImageView;
  import android.widget.LinearLayout;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.google.android.gms.auth.api.Auth;
  import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
  import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
  import com.google.android.gms.auth.api.signin.GoogleSignInResult;
  import com.google.android.gms.common.ConnectionResult;
  import com.google.android.gms.common.SignInButton;
  import com.google.android.gms.common.api.GoogleApiClient;
  import com.google.android.gms.common.api.OptionalPendingResult;
  import com.google.android.gms.common.api.ResultCallback;
  
  public class Login extends  AppCompatActivity   implements
          View.OnClickListener,
          GoogleApiClient.OnConnectionFailedListener {
  
      private static final String TAG = MainActivity.class.getSimpleName();
      private static final int RC_SIGN_IN = 007;
  
      private GoogleApiClient mGoogleApiClient;
      private ProgressDialog mProgressDialog;
  
      private SignInButton btnSignIn;
      private Button btnSignOut, btnRevokeAccess;
      private LinearLayout llProfileLayout;
      private ImageView imgProfilePic;
      private TextView txtName, txtEmail;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login);
  
          super.getIntent();
          btnSignIn = (SignInButton) findViewById(R.id.sign_in_button);
  
          btnSignIn.setOnClickListener(this);
  
  
  
          GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                  .requestEmail()
                  .build();
  
          mGoogleApiClient = new GoogleApiClient.Builder(this)
                  .enableAutoManage(this, this)
                  .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
                  .build();
  
          // Customizing G+ button
          btnSignIn.setSize(SignInButton.SIZE_STANDARD);
          btnSignIn.setScopes(gso.getScopeArray());
      }
  
  
      private void signIn() {
          Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
          startActivityForResult(signInIntent, RC_SIGN_IN);
      }
  
  
  
          private void handleSignInResult(GoogleSignInResult result) {
              Log.d(TAG, "handleSignInResult:" + result.isSuccess());
              if (result.isSuccess()) {
                  // Signed in successfully, show authenticated UI.
                  GoogleSignInAccount acct = result.getSignInAccount();
  
                  Log.e(TAG, "display name: " + acct.getDisplayName());
  
  
  
                  updateUI(true);
              } else {
                  // Signed out, show unauthenticated UI.
                  updateUI(false);
              }
          }
  
          @Override
          public void onClick(View v) {
              int id = v.getId();
  
              switch (id) {
                  case R.id.sign_in_button:
                      signIn();
                      break;
  
  
              }
          }
  
          @Override
          public void onActivityResult(int requestCode, int resultCode, Intent data) {
              super.onActivityResult(requestCode, resultCode, data);
  
              // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
              if (requestCode == RC_SIGN_IN) {
                  GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
                  handleSignInResult(result);
              }
          }
  
          @Override
          public void onStart() {
              super.onStart();
  
              OptionalPendingResult&lt;GoogleSignInResult&gt; opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
              if (opr.isDone()) {
                  // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
                  // and the GoogleSignInResult will be available instantly.
                  Log.d(TAG, "Got cached sign-in");
                  GoogleSignInResult result = opr.get();
                  handleSignInResult(result);
              } else {
                  // If the user has not previously signed in on this device or the sign-in has expired,
                  // this asynchronous branch will attempt to sign in the user silently.  Cross-device
                  // single sign-on will occur in this branch.
                  showProgressDialog();
                  opr.setResultCallback(new ResultCallback&lt;GoogleSignInResult&gt;() {
                      @Override
                      public void onResult(GoogleSignInResult googleSignInResult) {
                          hideProgressDialog();
                          handleSignInResult(googleSignInResult);
                      }
                  });
              }
          }
  
          @Override
          public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
              // An unresolvable error has occurred and Google APIs (including Sign-In) will not
              // be available.
              Log.d(TAG, "onConnectionFailed:" + connectionResult);
          }
  
          private void showProgressDialog() {
              if (mProgressDialog == null) {
                  mProgressDialog = new ProgressDialog(this);
                  mProgressDialog.setMessage("loading");
                  mProgressDialog.setIndeterminate(true);
              }
  
              mProgressDialog.show();
          }
  
          private void hideProgressDialog() {
              if (mProgressDialog != null &amp;&amp; mProgressDialog.isShowing()) {
                  mProgressDialog.hide();
              }
          }
  
          private void updateUI(boolean isSignedIn) {
              if (isSignedIn) {
                  btnSignIn.setVisibility(View.GONE);
                 Intent i = new Intent(Login.this,Signin.class);
                startActivity(i);
              } else {
                  btnSignIn.setVisibility(View.VISIBLE);
                  btnSignOut.setVisibility(View.GONE);
                  btnRevokeAccess.setVisibility(View.GONE);
                  llProfileLayout.setVisibility(View.GONE);
              }
          }
  }
  </code></pre>
  
  <p>And its xml code is :</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/main_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:weightSum="4"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="2"
          android:gravity="center_horizontal"
          android:orientation="vertical"&gt;
  
  
      &lt;/LinearLayout&gt;
  
  
      &lt;RelativeLayout
          android:layout_width="fill_parent"
          android:layout_height="0dp"
          android:layout_weight="2"&gt;
  
          &lt;com.google.android.gms.common.SignInButton
              android:id="@+id/sign_in_button"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:visibility="visible"
              tools:visibility="gone" /&gt;
  
  
  
  
      &lt;/RelativeLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>My LogCat is :</p>
  
  <pre><code> at com.google.android.gms.auth.api.Auth$4.zza(Unknown Source)
     at com.google.android.gms.common.api.GoogleApiClient$Builder.zza(Unknown Source)
     at com.google.android.gms.common.api.GoogleApiClient$Builder.zzuQ(Unknown Source)
     at com.google.android.gms.common.api.GoogleApiClient$Builder.build(Unknown Source)
     at com.example.hp_pc.earnmebucks.Login.onCreate(Login.java:67)
     at android.app.Activity.performCreate(Activity.java:6001)
     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2368)
     at android.app.ActivityThread.access$800(ActivityThread.java:144)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1285)
     at android.os.Handler.dispatchMessage(Handler.java:102)
     at android.os.Looper.loop(Looper.java:135)
     at android.app.ActivityThread.main(ActivityThread.java:5233)
     at java.lang.reflect.Method.invoke(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:372)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
  </code></pre>
  
  <p>Please help. My app crashes after splash activity. I will be highly grateful if anybody can help me. I dont able to know where is the null pointer exception.
  Thanks in advance.</p>