java.lang.RuntimeException: Unable to resume activity {highski.developers.cflash/highski.developers.cflash.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void highski.developers.cflash.connection_check.MyApplication.setConnectivityListener(highski.developers.cflash.connection_check.ConnectivityReceiver$ConnectivityReceiverListener)' 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

    NullPointer exception in Fragment while trying to instantiate a method from another class

    Stack Overflow | 7 months ago | karrthik database
    java.lang.RuntimeException: Unable to resume activity {highski.developers.cflash/highski.developers.cflash.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void highski.developers.cflash.connection_check.MyApplication.setConnectivityListener(highski.developers.cflash.connection_check.ConnectivityReceiver$ConnectivityReceiverListener)' on a null object reference

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'void highski.developers.cflash.connection_check.MyApplication.setConnectivityListener(highski.developers.cflash.connection_check.ConnectivityReceiver$ConnectivityReceiverListener)' on a null object reference

      at highski.developers.cflash.fragments.HomeFragment.onResume()
    2. highski.developers.cflash
      HomeFragment.onResume
      1. highski.developers.cflash.fragments.HomeFragment.onResume(HomeFragment.java:362)
      1 frame
    3. Android Support v4
      FragmentActivity.onPostResume
      1. android.support.v4.app.Fragment.performResume(Fragment.java:2020)
      2. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1107)
      3. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
      4. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234)
      5. android.support.v4.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:2056)
      6. android.support.v4.app.FragmentController.dispatchResume(FragmentController.java:196)
      7. android.support.v4.app.FragmentActivity.onResumeFragments(FragmentActivity.java:504)
      8. android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:493)
      8 frames
    4. Android v7
      AppCompatActivity.onPostResume
      1. android.support.v7.app.AppCompatActivity.onPostResume(AppCompatActivity.java:178)
      1 frame
    5. Android Platform
      ActivityThread.performResumeActivity
      1. android.app.Activity.performResume(Activity.java:6089)
      2. android.app.ActivityThread.performResumeActivity(ActivityThread.java:2975)
      2 frames