Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8678907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:50:24+00:00 2026-06-12T20:50:24+00:00

Here is my AsyncTask. Getting JSONException inside the doInbackground method. try { Log.v(thisurl, url);

  • 0

Here is my AsyncTask. Getting JSONException inside the doInbackground method.

 try {
    Log.v("thisurl", url);
    JSONArray data_holder = new JSONArray();
    JSONParser jParser = new JSONParser();
    // getting JSON string from URL
    JSONObject json = jParser.getJSONFromUrl(url);
            data_holder = json.getJSONArray(data_val);
    for (int i = 0; i < data_holder.length(); i++) {
        HashMap<String, String> data_map = new HashMap<String, String>();
        JSONObject obj = data_holder.getJSONObject(i);
             }
      }

Catching the exception. But I am unable to find the reason from that. The URL fetches the json response correctly when I check that manually. Here is my stack trace.

 W/System.err(3353): org.json.JSONException: No value for searchresult
 W/System.err(3353):    at org.json.JSONObject.get(JSONObject.java:354)
 W/System.err(3353):    at org.json.JSONObject.getJSONArray(JSONObject.java:544)
 W/System.err(3353):    at com.store.SearchResultActivity$getJsonProductData.doInBackground(SearchResultActivity.java:318)
 W/System.err(3353):    at com.store.SearchResultActivity$getJsonProductData.doInBackground(SearchResultActivity.java:1)
 W/System.err(3353):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
 W/System.err(3353):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
 W/System.err(3353):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
 W/System.err(3353):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
 W/System.err(3353):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
 W/System.err(3353):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
 W/System.err(3353):    at java.lang.Thread.run(Thread.java:856)
 D/AndroidRuntime(3353): Shutting down VM
 W/dalvikvm(3353): threadid=1: thread exiting with uncaught exception (group=0x40ccb300)

Can anyone point out what I am doing wrongly here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:50:25+00:00Added an answer on June 12, 2026 at 8:50 pm

    Error is on line

     data_holder = json.getJSONArray(data_val);
    

    and its because, there is no jsonarray exists with key data_val. check response, and value of data_val. if these are matching properly, or not, also just for a note, key value are case sensitive.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting a CalledFromWrongThreadException even if i throw it into AsyncTask's DoInBackground method!
Here is my AsyncTask. Getting exception in the AsyncTask.. private class GetCategories extends AsyncTask<String,
Here is where i am getting a error at.. in the doInBackground in my
Getting this error: java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:200) at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
I am using the AsyncTask and I am getting the following error in the
fairly new Android developer here. I've come across a strange problem that I'm not
I have a live app that uses AsyncTask in several activities, and I'm getting
Inside of onPause, I'm calling cancel(true) on the AsyncTask called PlayTask. However, it still
I keep getting these errors while retreiving images here. 07-26 17:21:29.194: ERROR/AndroidRuntime(396): java.lang.RuntimeException: An

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.