title: facebook login button implementation
body: <p>After implementing the login button this appears as an error  </p>
  
  <pre><code> E/AndroidRuntime: FATAL EXCEPTION: main
                    Process: com.foksart.fixawyBeta, PID: 2773
                    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.foksart.fixawyBeta/com.foksart.fixawyBeta.LoginActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.login.widget.LoginButton.setReadPermissions(java.lang.String[])' on a null object reference
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                        at android.app.ActivityThread.-wrap11(ActivityThread.java)
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                        at android.os.Handler.dispatchMessage(Handler.java:102)
                        at android.os.Looper.loop(Looper.java:148)
                        at android.app.ActivityThread.main(ActivityThread.java:5417)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.login.widget.LoginButton.setReadPermissions(java.lang.String[])' on a null object reference
                        at com.foksart.fixawyBeta.LoginActivity.onCreate(LoginActivity.java:75)
                        at android.app.Activity.performCreate(Activity.java:6237)
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                        at android.os.Looper.loop(Looper.java:148) 
                        at android.app.ActivityThread.main(ActivityThread.java:5417) 
                        at java.lang.reflect.Method.invoke(Native Method) 
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
  </code></pre>
  
  <p>and my android manifest code is </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.foksart.fixawyBeta"&gt;
      &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.NoActionBar"&gt;
  
  
          &lt;meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/&gt;
          &lt;activity android:name=".MainActivity"&gt;
          &lt;/activity&gt;
  
          &lt;activity
              android:name="com.facebook.CustomTabActivity"
              android:exported="true"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.VIEW" /&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                 &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
                  &lt;data android:scheme="@string/fb_login_protocol_scheme" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity android:name=".LoginActivity"&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;activity android:name="com.facebook.FacebookActivity"
          android:configChanges=
          "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
          android:label="@string/app_name" /&gt;
          &lt;provider android:authorities="com.facebook.app.FacebookContentProvider1796817573897293"
          android:name="com.facebook.FacebookContentProvider"
          android:exported="true"/&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>and my activity.xml code is this </p>
  
  <pre><code>&lt;android.support.design.widget.CoordinatorLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/content_login_page"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/bg"
      android:fitsSystemWindows="true"
      tools:context="com.foksart.fixawyBeta.LoginActivity"
      tools:showIn="@layout/activity_login_page"&gt;
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  &lt;com.facebook.login.widget.LoginButton
              android:id="@+id/login_button"
              android:layout_width="80dp"
              android:layout_height="32dp"
              android:layout_below="@id/facebookTxt"
              android:layout_centerHorizontal="true"
              android:layout_marginTop="10dp"
              android:background="@drawable/facebookbtn"
              android:text="@string/facebook_btn"
              android:textColor="#ffffff"
              android:textSize="18sp"/&gt;
  &lt;/RelativeLayout&gt;
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>activity.java code</p>
  
  <pre><code>import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.widget.LinearLayout;
  import com.facebook.CallbackManager;
  import com.facebook.FacebookSdk;
  import com.facebook.appevents.AppEventsLogger;
  import com.facebook.login.widget.LoginButton;
  import android.widget.Button;
  import com.facebook.AccessToken;
  import com.facebook.FacebookCallback;
  import com.facebook.FacebookException;
  import com.facebook.GraphRequest;
  import com.facebook.GraphResponse;
  import com.facebook.login.LoginResult;
  import org.json.JSONException;
  import org.json.JSONObject;
  public class LoginActivity extends  AppCompatActivity   {
      private LinearLayout registrationForm;
      private ImageView collapseForm;
      private BottomSheetBehavior myBottomSheetBehavior;
      CallbackManager callbackManager;
      Button share,details;
      ShareDialog shareDialog;
      LoginButton login;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login_page);  
          FacebookSdk.sdkInitialize(getApplicationContext());
          AppEventsLogger.activateApp(getApplication());
          callbackManager = CallbackManager.Factory.create();
          login = (LoginButton)findViewById(R.id.login_button);
          login.setReadPermissions("public_profile email");
      }
  }
  </code></pre>
  
  <p>i don't know what is going on and i am stuck for a while , i followed the documentation for facebook login implementation</p>