java.lang.RuntimeException: Unable to start activity ComponentInfo{noob.com.noobfilechooser/com.noob.noobfilechooser.NoobFileActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageButton.setVisibility(int)' on a null object reference

Stack Overflow | noob | 4 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    ButterKnife view binding in Library project for BaseFragment fails

    Stack Overflow | 4 months ago | noob
    java.lang.RuntimeException: Unable to start activity ComponentInfo{noob.com.noobfilechooser/com.noob.noobfilechooser.NoobFileActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageButton.setVisibility(int)' on a null object reference

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'void android.widget.ImageButton.setVisibility(int)' on a null object reference

      at com.noob.noobfilechooser.fragments.NoobFileFragment.turnOnMultiSelectMode()
    2. com.noob.noobfilechooser
      BaseFragment.onCreateView
      1. com.noob.noobfilechooser.fragments.NoobFileFragment.turnOnMultiSelectMode(NoobFileFragment.java:177)
      2. com.noob.noobfilechooser.fragments.NoobFileFragment.initializeRecyclerView(NoobFileFragment.java:84)
      3. com.noob.noobfilechooser.fragments.NoobFileFragment.onSetupView(NoobFileFragment.java:70)
      4. com.noob.noobfilechooser.fragments.BaseFragment.onCreateView(BaseFragment.java:24)
      4 frames
    3. Android Support v4
      FragmentActivity.onStart
      1. android.support.v4.app.Fragment.performCreateView(Fragment.java:2080)
      2. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108)
      3. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)
      4. android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)
      5. android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1677)
      6. android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388)
      7. android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:604)
      7 frames
    4. Android v7
      AppCompatActivity.onStart
      1. android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
      1 frame
    5. Android Platform
      ActivityThread.main
      1. android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1238)
      2. android.app.Activity.performStart(Activity.java:6340)
      3. android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2397)
      4. android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
      5. android.app.ActivityThread.access$900(ActivityThread.java:153)
      6. android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
      7. android.os.Handler.dispatchMessage(Handler.java:102)
      8. android.os.Looper.loop(Looper.java:148)
      9. android.app.ActivityThread.main(ActivityThread.java:5451)
      9 frames
    6. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      1 frame
    7. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
      2 frames