java.lang.RuntimeException: An error occurred while executing doInBackground()

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

    if i enter any random words it is not displaying "NO book found"

    Stack Overflow | 4 months ago | Ashish Choudhary
    java.lang.RuntimeException: An error occurred while executing doInBackground()

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference

      at com.example.ashis.booklisting.QueryUtils.extractFromJson()
    2. com.example.ashis
      MainActivity$BookAsyncTask.doInBackground
      1. com.example.ashis.booklisting.QueryUtils.extractFromJson(QueryUtils.java:69)
      2. com.example.ashis.booklisting.QueryUtils.fetchBookData(QueryUtils.java:38)
      3. com.example.ashis.booklisting.MainActivity$BookAsyncTask.doInBackground(MainActivity.java:58)
      4. com.example.ashis.booklisting.MainActivity$BookAsyncTask.doInBackground(MainActivity.java:51)
      4 frames
    3. Android Platform
      AsyncTask$2.call
      1. android.os.AsyncTask$2.call(AsyncTask.java:295)
      1 frame
    4. Java RT
      FutureTask.run
      1. java.util.concurrent.FutureTask.run(FutureTask.java:237)
      1 frame
    5. Android Platform
      AsyncTask$SerialExecutor$1.run
      1. android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
      1 frame
    6. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
      3. java.lang.Thread.run(Thread.java:818)
      3 frames