Error in http connection
<p>hi I am trying to fetch data from link as given below</p>

<pre><code> http://abovestress.com/app_stress/fetch_all_detail.php?task=fetchtimefromdateanduserid&amp;track_date=2011-08-09&amp;tracker_user_id=374
</code></pre>

<p>but I can't get result my code is here</p>

<pre><code>package com.JsonDemo;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class JsonDemoActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    ArrayList&lt;String&gt; fetchsosfromID = new ArrayList&lt;String&gt;();
    String result = "";
    InputStream is = null;

    ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
    nameValuePairs.add(new BasicNameValuePair("track_date","2011-08-09"));
    nameValuePairs.add(new BasicNameValuePair("tracker_user_id",""+374));

    try {
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost(
                "http://abovestress.com/app_stress/fetch_all_detail.php?task=fetchtimefromdateanduserid&amp;");
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse response = httpclient.execute(httppost);
        HttpEntity entity = response.getEntity();
        is = entity.getContent();
    } catch (Exception e) {
        Log.e("log_tag", "Error in http connection " + e.toString());
    }
    // convert response to string
    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();
        result = sb.toString();
        Log.v("log_tag", "Append String " + result);
    } catch (Exception e) {
        Log.e("log_tag", "Error converting result " + e.toString());
    }

    // parse json data
    try {
        JSONArray jArray = new JSONArray(result);
        for (int i = 0; i &lt; jArray.length(); i++) {
            JSONObject json_data = jArray.getJSONObject(i);
            fetchsosfromID.add(json_data.getString("track_time"));
            Log.v("log_tag", "daily_data " + fetchsosfromID);
        }
    } catch (JSONException e) {
        Log.e("log_tag", "Error parsing data " + e.toString());
    }
}
</code></pre>

<p>}</p>

<p>and error comes like this</p>

<pre><code>08-09 17:29:01.315: ERROR/log_tag(2291): Error in http connection java.net.UnknownHostException: abovestress.com
08-09 17:29:01.315: ERROR/log_tag(2291): Error converting result java.lang.NullPointerException
08-09 17:29:01.345: ERROR/log_tag(2291): Error parsing data org.json.JSONException: End of input at character 0 of 
</code></pre>

<p>manifiest </p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.JsonDemo"
  android:versionCode="1"
  android:versionName="1.0"&gt;
&lt;uses-sdk android:minSdkVersion="9" /&gt;

&lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
    &lt;activity android:name=".JsonDemoActivity"
              android:label="@string/app_name"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
&lt;/application&gt;
&lt;/manifest&gt;
</code></pre>
