title: Login using facebook sdk gives error on onActivityResult
body: <p>I am getting error while using facebook sdk. it gives me an error on OnActivtyResult method. </p>
  
  <p>Please review my code given below.  </p>
  
  <p>This  is the LogCat result:</p>
  
  <pre><code>07-05 22:33:51.762 24690-24690/uni.ek.com.re_think E/AndroidRuntime: FATAL EXCEPTION: main
                                                                   java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=-1, data=Intent { (has extras) }} to activity {uni.ek.com.re_think/uni.ek.com.re_think.MainActivity}: java.lang.NullPointerException
                                                                       at android.app.ActivityThread.deliverResults(ActivityThread.java:3462)
                                                                       at android.app.ActivityThread.handleSendResult(ActivityThread.java:3505)
                                                                       at android.app.ActivityThread.access$1100(ActivityThread.java:150)
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                       at android.os.Looper.loop(Looper.java:213)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5225)
                                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                                       at java.lang.reflect.Method.invoke(Method.java:525)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
                                                                       at dalvik.system.NativeStart.main(Native Method)
                                                                    Caused by: java.lang.NullPointerException
                                                                       at uni.ek.com.re_think.MainActivity.onActivityResult(MainActivity.java:134)
                                                                       at android.app.Activity.dispatchActivityResult(Activity.java:5322)
                                                                       at android.app.ActivityThread.deliverResults(ActivityThread.java:3458)
                                                                       at android.app.ActivityThread.handleSendResult(ActivityThread.java:3505) 
                                                                       at android.app.ActivityThread.access$1100(ActivityThread.java:150) 
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346) 
                                                                       at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                       at android.os.Looper.loop(Looper.java:213) 
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5225) 
                                                                       at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                       at java.lang.reflect.Method.invoke(Method.java:525) 
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741) 
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 
                                                                       at dalvik.system.NativeStart.main(Native Method) 
  </code></pre>
  
  <p>This is the MainActivity:</p>
  
  <pre><code>package uni.ek.com.re_think;
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  import com.facebook.CallbackManager;
  import com.facebook.FacebookCallback;
  import com.facebook.FacebookException;
  import com.facebook.FacebookSdk;
  import com.facebook.login.LoginResult;
  import com.facebook.login.widget.LoginButton;
  
  public class MainActivity extends AppCompatActivity {
  
  EditText name,pass;
  Button login;
  LoginButton fb_login;
  String name1,pass1;
  int count,counter;
  CallbackManager callbackManager;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      FacebookSdk.sdkInitialize(getApplicationContext());
      CallbackManager callbackManager = CallbackManager.Factory.create();
  
      setContentView(R.layout.activity_main);
  
  
  
  
  
  
      fb_login= (LoginButton)findViewById(R.id.btnl_fblogin);
      //////////////////
      fb_login.registerCallback(callbackManager, new FacebookCallback&lt;LoginResult&gt;() {
          @Override
          public void onSuccess(LoginResult loginResult) {
  
              Toast.makeText(getApplicationContext(),"success",Toast.LENGTH_SHORT).show();
          }
  
          @Override
          public void onCancel() {
  
          }
  
          @Override
          public void onError(FacebookException error) {
  
          }
      });
  
  
  }
  
  
  
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      callbackManager.onActivityResult(requestCode, resultCode, data);
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Mainfest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
  
      &lt;meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/&gt;
  
      &lt;activity android:name="com.facebook.FacebookActivity"
          android:configChanges=
              "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
          android:theme="@android:style/Theme.Translucent.NoTitleBar"
          android:label="@string/app_name" /&gt;
      &lt;activity android:name=".MainActivity" android:screenOrientation="portrait"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>Please solve the issue</p>