title: Custom Login with Twitter in android
body: <p>How to create custom buttons for social login auth for twitter on android application development. By default social media have different SDK, which SDK twitter already has its own button social login but i want to use my own custom button and i wrote some code but getting exception </p>
  
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
  </code></pre>
  
  <h2>my code:-</h2>
  
  <pre><code>TwitterConfig config = new TwitterConfig.Builder(this)
                      .logger(new DefaultLogger(Log.DEBUG))
                      .twitterAuthConfig(new TwitterAuthConfig("KEY",
                              "KEY"))
                      .debug(true)
                      .build();
              Twitter.initialize(config);
              client = new TwitterAuthClient();
              final TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
              twitterButton.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
  
                      client.requestEmail(session, new Callback&lt;String&gt;() {
                          @Override
                          public void success(Result&lt;String&gt; result) {
                              System.out.println("Email is=====&gt;" + result.data);
                          }
  
                          @Override
                          public void failure(TwitterException exception) {
  
                          }
                      });
                  }
              });
  </code></pre>