java.lang.NullPointerException: Attempt to invoke virtual method 'boolean elektro_fr.my_android.ui.My_Fragment.isAdded()' on a null object reference

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

    Android Fragment - Replace fragment when finished

    Stack Overflow | 8 months ago | Francesco Rizzi
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean elektro_fr.my_android.ui.My_Fragment.isAdded()' on a null object reference

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'boolean elektro_fr.my_android.ui.My_Fragment.isAdded()' on a null object reference

      at elektro_fr.my_android.ui.My_Activity.removeFragment()
    2. elektro_fr.my_android.ui
      My_Activity.removeFragment
      1. elektro_fr.my_android.ui.My_Activity.removeFragment(My_Activity.java:296)
      1 frame
    3. elektro_fr.newapplication.Compito
      Fragment_2.setGraphics
      1. elektro_fr.newapplication.Compito.Fragment.MainActivity.clickButtonOperation(MainActivity.java:62)
      2. elektro_fr.newapplication.Compito.Fragment.Fragment_2.setGraphics(Fragment_2.java:35)
      2 frames
    4. elektro_fr.my_android.ui
      My_Fragment.onCreateView
      1. elektro_fr.my_android.ui.My_Fragment.onCreateView(My_Fragment.java:66)
      1 frame
    5. Android Support v4
      Fragment.performCreateView
      1. android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
      1 frame