title: NullPointerException: Attempt to invoke virtual method on a null object reference?
body: <p>I get a NUllPointerException when trying to invoke a method on a button:</p>
  
  <pre><code>private FButton fButton1;
  ...
  ...
  fButton1 = (FButton) findViewById(R.id.FButton1);
  fButton1.setButtonColor(ContextCompat.getColor(this, fbutton_color_turquoise));    //Exception here
  </code></pre>
  
  <p>I am using <a href="https://github.com/hoang8f/android-flat-button" rel="nofollow noreferrer">this library here</a> and I don't get why I get the exception?</p>
  
  <p>ERROR LOG:</p>
  
  <pre><code>FATAL EXCEPTION: main
                                                     Process: com.user.app, PID: 11209
                                                     java.lang.RuntimeException: Unable to start activity ComponentInfo{com.user.app/com.user.app.activities.StartUpScreen}: java.lang.NullPointerException: Attempt to invoke virtual method 'void info.hoang8f.widget.FButton.setButtonColor(int)' 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 info.hoang8f.widget.FButton.setButtonColor(int)' on a null object reference
                                                         at com.user.app.activities.StartUpScreen.onCreate(StartUpScreen.java:44)
                                                         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>my layout.xml where FButton is:</p>
  
  <pre><code>&lt;info.hoang8f.widget.FButton
      fbutton:buttonColor="@color/fbutton_color_turquoise"
      fbutton:shadowColor="@color/fbutton_color_green_sea"
      fbutton:shadowEnabled="true"
      fbutton:shadowHeight="5dp"
      android:text="Celcius"
      android:textColor="#FFF"
      fbutton:cornerRadius="5dp"
      android:layout_marginTop="8dp"
      app:layout_constraintTop_toBottomOf="@+id/imageButton3"
      android:layout_marginLeft="8dp"
      app:layout_constraintLeft_toLeftOf="parent"
      android:layout_height="wrap_content"
      android:layout_marginStart="8dp"
      android:layout_width="match_parent"
      android:id="@+id/FButton1"
      app:layout_constraintRight_toLeftOf="@+id/FButton2"
      android:layout_marginRight="8dp"
      android:layout_marginEnd="8dp"
      app:layout_constraintHorizontal_bias="1.0" /&gt;
  </code></pre>
  
  <p>My ids.xml file that I had to create, since android did not recoginze the id:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
      &lt;item name="FButton1" type="id" /&gt;
  &lt;/resources&gt;
  </code></pre>