java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference

Stack Overflow | Mina Dahesh | 7 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Running service with CountDownTimer in Android Screen

    Stack Overflow | 7 months ago | Mina Dahesh
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference

      at com.androidexample.screenonoff.AEScreenOnOffService$1.run()
    2. com.androidexample.screenonoff
      AEScreenOnOffService$1.run
      1. com.androidexample.screenonoff.AEScreenOnOffService$1.run(AEScreenOnOffService.java:50)
      1 frame
    3. Android Platform
      ActivityThread.main
      1. android.os.Handler.handleCallback(Handler.java:739)
      2. android.os.Handler.dispatchMessage(Handler.java:95)
      3. android.os.Looper.loop(Looper.java:145)
      4. android.app.ActivityThread.main(ActivityThread.java:6837)
      4 frames
    4. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:372)
      2 frames
    5. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
      2 frames