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

  • SEARCH
  • Home
  • 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 8817375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:49:56+00:00 2026-06-14T04:49:56+00:00

I want to retrieve the data from this json url but is gives error.

  • 0

I want to retrieve the data from this json url but is gives error. I put in the last I have another json with this code work perfectly but in this here is not work so what is the problem and how to solve?

http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=restaurant&rsz=8&sll=-27.5595451,-48.6206452&radius=1000&output=json

JsonParserSearch.java

 public class JsonParserSearch 
 {
static InputStream is = null;
static JSONObject jObj = null;
static String json = "";

// constructor
public JsonParserSearch() {

}

public JSONObject getJSONFromUrl(String url) {

    // Making HTTP request
    try {
        // defaultHttpClient
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(url);

        HttpResponse httpResponse = httpClient.execute(httpPost);
        HttpEntity httpEntity = httpResponse.getEntity();
        is = httpEntity.getContent();          

    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                is, "iso-8859-1"), 8);
        StringBuilder sb = new StringBuilder();
        String line = null;
        while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");
        }
        is.close();
        json = sb.toString();
    } catch (Exception e) {
        Log.e("Buffer Error", "Error converting result " + e.toString());
    }

    // try parse the string to a JSON object
    try {
        jObj = new JSONObject(json);
    } catch (JSONException e) {
        Log.e("JSON Parser finaal", "Error parsing data " + e.toString());
    }

    // return JSON String
    return jObj;

}

}

SearchListActivity.java

public class SearchlistActivity extends Activity {

private static String url="http://ajax.googleapis.com/ajax/services/search/local?v=1.0&q=restaurant&rsz=8&sll=-27.5595451,-48.6206452&radius=1000&output=json";
private static final String TAG_RESULTS = "results";
private static final String TAG_RESPONSEDATA="responseData";    

@Override
public void onCreate(Bundle savedInstanceState)

{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    //JSONArray results = null;       
     JSONArray responseData=null;
 // Hashmap for ListView
    ArrayList<HashMap<String, String>> contactList = new ArrayList<HashMap<String, String>>();

    // Creating JSON Parser instance
    JsonParserSearch jParser = new JsonParserSearch();


    // getting JSON string from URL
    JSONObject json = jParser.getJSONFromUrl(url);

    try {
        // Getting Array of Contacts

         responseData = json.getJSONArray(TAG_RESPONSEDATA);
         Log.e("jsonnn data","sfsssss00000-------->"+responseData);

        }
    catch (JSONException e) {
        e.printStackTrace();
    }

}

}

11-09 01:18:14.241: E/Buffer Error(275): Error converting result java.lang.NullPointerException
11-09 01:18:14.241: E/JSON Parser finaal(275): Error parsing data org.json.JSONException: End of input at character 0 of 
11-09 01:18:14.251: D/AndroidRuntime(275): Shutting down VM
11-09 01:18:14.251: W/dalvikvm(275): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-09 01:18:14.261: E/AndroidRuntime(275): FATAL EXCEPTION: main
11-09 01:18:14.261: E/AndroidRuntime(275): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ssss/com.example.ssss.SearchlistActivity}: java.lang.NullPointerException
11-09 01:18:14.261: E/AndroidRuntime(275):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
11-09 01:18:14.261: E/AndroidRuntime(275):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-09 01:18:14.261: E/AndroidRuntime(275):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-09 01:18:14.261: E/AndroidRuntime(275):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-09 01:18:14.261: E/AndroidRuntime(275):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 01:18:14.261: E/AndroidRuntime(275):  at android.os.Looper.loop(Looper.java:123)
11-09 01:18:14.261: E/AndroidRuntime(275):  at android.app.ActivityThread.main(ActivityThread.java:4627)
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
11-09 00:45:17.072: W/System.err(302):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
11-09 00:45:17.072: W/System.err(302):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
11-09 00:45:17.072: W/System.err(302):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
11-09 00:45:17.072: W/System.err(302):  at com.example.sss.JsonParserSearch.getJSONFromUrl(JsonParserSearch.java:38)
11-09 00:45:17.072: W/System.err(302):  at com.example.sss.SearchlistActivity.onCreate(SearchlistActivity.java:39)
11-09 00:45:17.072: W/System.err(302):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-09 00:45:17.082: W/System.err(302):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-09 00:45:17.082: W/System.err(302):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-09 00:45:17.082: W/System.err(302):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-09 00:45:17.082: W/System.err(302):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-09 00:45:17.082: W/System.err(302):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 00:45:17.082: W/System.err(302):  at android.os.Looper.loop(Looper.java:123)
11-09 00:45:17.082: W/System.err(302):  at android.app.ActivityThread.main(ActivityThread.java:4627)
11-09 00:45:17.082: W/System.err(302):  at java.lang.reflect.Method.invokeNative(Native Method)
11-09 00:45:17.082: W/System.err(302):  at java.lang.reflect.Method.invoke(Method.java:521)
11-09 00:45:17.092: W/System.err(302):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-09 00:45:17.092: W/System.err(302):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-09 00:45:17.092: W/System.err(302):  at dalvik.system.NativeStart.main(Native Method)
11-09 00:45:17.092: E/Buffer Error(302): Error converting result java.lang.NullPointerException
11-09 00:45:17.092: E/JSON Parser finaal(302): Error parsing data org.json.JSONException: End of input at character 0 of 
11-09 00:45:17.103: D/AndroidRuntime(302): Shutting down VM
11-09 00:45:17.103: W/dalvikvm(302): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-09 00:45:17.112: E/AndroidRuntime(302): FATAL EXCEPTION: main
11-09 00:45:17.112: E/AndroidRuntime(302): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sss/com.example.sss.SearchlistActivity}: java.lang.NullPointerException
11-09 00:45:17.112: E/AndroidRuntime(302):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
11-09 00:45:17.112: E/AndroidRuntime(302):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-09 00:45:17.112: E/AndroidRuntime(302):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-09 00:45:17.112: E/AndroidRuntime(302):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-09 00:45:17.112: E/AndroidRuntime(302):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 00:45:17.112: E/AndroidRuntime(302):  at android.os.Looper.loop(Looper.java:123)
11-09 00:45:17.112: E/AndroidRuntime(302):  at android.app.ActivityThread.main(ActivityThread.java:4627)
11-09 00:45:17.112: E/AndroidRuntime(302):  at java.lang.reflect.Method.invokeNative(Native Method)
11-09 00:45:17.112: E/AndroidRuntime(302):  at java.lang.reflect.Method.invoke(Method.java:521)
11-09 00:45:17.112: E/AndroidRuntime(302):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-09 00:45:17.112: E/AndroidRuntime(302):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-09 00:45:17.112: E/AndroidRuntime(302):  at dalvik.system.NativeStart.main(Native Method)
11-09 00:45:17.112: E/AndroidRuntime(302): Caused by: java.lang.NullPointerException
11-09 00:45:17.112: E/AndroidRuntime(302):  at com.example.sss.SearchlistActivity.onCreate(SearchlistActivity.java:44)
11-09 00:45:17.112: E/AndroidRuntime(302):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-09 00:45:17.112: E/AndroidRuntime(302):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-09 00:45:17.112: E/AndroidRuntime(302):  ... 11 more
  • 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-14T04:49:57+00:00Added an answer on June 14, 2026 at 4:49 am

    It looks like your phone/emulator is unable to resolve the hostname for ajax.googleapis.com. ( java.net.UnknownHostException). I’d suggest you to check your phone/emulator connectivity with the internet (eg: put the mentioned URL in the phone browser window and check if it works).

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

Sidebar

Related Questions

I'm trying to retrieve some data from a JSON response, but this doesn't seem
I have DropDownList with CascadingDropDown extender. If I want to retrieve data from the
I want to retrieve the JSON from http://www.bartdekimpe.be/anoire/index.php/admin/getGamesUserJson/34 but I can't seem to get
I want to retrieve data from sqlite. user can have more than 1 score
I retrieve data from a mysql database. I want to make this data available
As the title says, i want to retrieve my Json data values from a
I want to be able to Ajax-ly retrieve JSON data from some kind of
I'm making an iPhone app in which I retrieve JSON data from http://maps.googleapis.com/maps/api/geocode/json?address=canada&sensor=true ,
I am trying to retrieve data with JSON from my database and parse them
For a specific requirement in my project, I want to retrieve JSON response from

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.