java.lang.IllegalStateException: System services not available to Activities before onCreate()

Stack Overflow | Federick Jons | 9 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

    Run a AsyncTask class from a service

    Stack Overflow | 9 months ago | Federick Jons
    java.lang.IllegalStateException: System services not available to Activities before onCreate()

    Root Cause Analysis

    1. java.lang.IllegalStateException

      System services not available to Activities before onCreate()

      at android.app.Activity.getSystemService()
    2. Android Platform
      ProgressDialog.<init>
      1. android.app.Activity.getSystemService(Activity.java:5055)
      2. android.app.Dialog.<init>(Dialog.java:164)
      3. android.app.AlertDialog.<init>(AlertDialog.java:125)
      4. android.app.AlertDialog.<init>(AlertDialog.java:121)
      5. android.app.ProgressDialog.<init>(ProgressDialog.java:82)
      5 frames
    3. com.exampe
      CalcularHorariosComplejoAsyncTask.<init>
      1. com.exampe.CalcularHorariosComplejoAsyncTask.<init>(CalcularHorariosComplejoAsyncTask.java:78)
      1 frame
    4. com.example
      CalcularHorariosComplejoService.onHandleIntent
      1. com.example.CalcularHorariosComplejoService.onHandleIntent(CalcularHorariosComplejoService.java:37)
      1 frame
    5. Android Platform
      HandlerThread.run
      1. android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
      2. android.os.Handler.dispatchMessage(Handler.java:102)
      3. android.os.Looper.loop(Looper.java:135)
      4. android.os.HandlerThread.run(HandlerThread.java:61)
      4 frames