I am getting error in Json parsing
<p>This is my searchactivity. I am using below code.When I am hitting the SearchUrl in browser it gives correct response but while parsing it using this code getting below error.I don't understand why this happens?</p>

<pre><code>public class SearchListActivity extends Activity {

    ListView SearchResults;
    private String SearchUrl = "http://www.adultretailfinder.com.au/api/search?transport=get&amp;";
    AdultRetailFinderUtils util;
    ArrayList&lt;AdultRetailFinderDTO&gt; SearchArrayList;
    ListAdapter adapter;
    JSONObject json;
    Bundle myBundle;
    private JSONParser jsonParser;
    String SearchKeyword, type;
    MyCustomAdapter myAdapter;
    JSONArray searchArray = null;
    ProgressDialog dialog;
    Boolean searchFlag = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.search_list_layout);
        initDisplay();

    }

    class MyCustomAdapter extends BaseAdapter {

        public int getCount() {
            return SearchArrayList.size();
        }

        public String getItem(int position) {
            return null;
        }

        public long getItemId(int position) {
            return position;
        }

        public View getView(int position, View convertView, ViewGroup parent) {

            LayoutInflater inflater = getLayoutInflater();
            View row;

            row = inflater.inflate(R.layout.searchrow_layout, parent, false);

            TextView BusinessText = (TextView) row.findViewById(R.id.txt);
            BusinessText.setText(SearchArrayList.get(position)
                    .getBusinessName());

            return (row);
        }

    }

    private void initDisplay() {

        myBundle = new Bundle();
        myBundle = getIntent().getExtras();
        SearchResults = (ListView) findViewById(R.id.search_lv);
        dialog = new ProgressDialog(SearchListActivity.this);
        jsonParser = new JSONParser();
        SearchArrayList = new ArrayList&lt;AdultRetailFinderDTO&gt;();
        util = new AdultRetailFinderUtils(SearchListActivity.this);
        SearchKeyword = myBundle.getString("SEARCHKEYWORD");
        type = myBundle.getString("TYPE");

        Log.v("SEARCHKEYWORD::", SearchKeyword);
        Log.v("TYPE::", type);
        myAdapter = new MyCustomAdapter();

        if (jsonParser.isNetworkAvailable(SearchListActivity.this)) {
            new BGTaskForSearch().execute();
        } else {
            Toast.makeText(SearchListActivity.this,
                    getResources().getString(R.string.network_not_available),
                    Toast.LENGTH_LONG).show();
        }

    }

    private class BGTaskForSearch extends
            AsyncTask&lt;String, Void, ArrayList&lt;AdultRetailFinderDTO&gt;&gt; {
        protected void onPreExecute() {

            dialog.setMessage("Loading...");
            dialog.setCancelable(false);
            dialog.show();

        }

        @Override
        protected ArrayList&lt;AdultRetailFinderDTO&gt; doInBackground(String... args) {

            // String urlstr= searchURL+selectedData+"Status=1&amp;Prov_ID=19";
            List&lt;NameValuePair&gt; params = new LinkedList&lt;NameValuePair&gt;();
            params.add(new BasicNameValuePair("keywords", SearchKeyword));
            params.add(new BasicNameValuePair("filter", "shops"));
            params.add(new BasicNameValuePair("type", type));
            String paramString = URLEncodedUtils.format(params, "utf-8");
            String newUrl = SearchUrl + paramString;
            Log.v("urlstr", newUrl);
            JSONObject json = jsonParser.getJSONFromUrl(newUrl);
            SearchArrayList = util.getJsonParsedResp(json);

            // TODO Auto-generated method stub

            if (SearchArrayList != null) {
                return SearchArrayList;
            } else {
                return null;
            }

        }

        protected void onPostExecute(ArrayList&lt;AdultRetailFinderDTO&gt; list) {
            dialog.dismiss();
            if (list != null) {

                SearchResults.setAdapter(myAdapter);

            } else
                Toast.makeText(SearchListActivity.this, "no records are found",
                        Toast.LENGTH_LONG).show();

        }
    }

}
</code></pre>

<p>This type of error I am getting:</p>

<pre><code>01-29 17:24:06.027: E/Trace(1775): error opening trace file: No such file or directory (2)
01-29 17:24:06.577: D/dalvikvm(1775): GC_FOR_ALLOC freed 72K, 3% free 8056K/8259K, paused 41ms, total 42ms
01-29 17:24:06.597: I/dalvikvm-heap(1775): Grow heap (frag case) to 9.380MB for 1536016-byte allocation
01-29 17:24:06.707: D/dalvikvm(1775): GC_CONCURRENT freed 1K, 3% free 9555K/9799K, paused 72ms+4ms, total 116ms
01-29 17:24:06.797: D/dalvikvm(1775): GC_FOR_ALLOC freed 4K, 3% free 9725K/9991K, paused 38ms, total 38ms
01-29 17:24:06.807: I/dalvikvm-heap(1775): Grow heap (frag case) to 10.455MB for 953364-byte allocation
01-29 17:24:06.927: D/dalvikvm(1775): GC_CONCURRENT freed &lt;1K, 3% free 10656K/10951K, paused 74ms+5ms, total 116ms
01-29 17:24:06.927: D/dalvikvm(1775): WAIT_FOR_CONCURRENT_GC blocked 7ms
01-29 17:24:07.277: I/Choreographer(1775): Skipped 53 frames!  The application may be doing too much work on its main thread.
01-29 17:24:07.397: D/gralloc_goldfish(1775): Emulator without GPU emulation detected.
01-29 17:24:07.637: I/Choreographer(1775): Skipped 65 frames!  The application may be doing too much work on its main thread.
01-29 17:24:13.086: V/SEARCHKEYWORD::(1775): adult
01-29 17:24:13.086: V/TYPE::(1775): business
01-29 17:24:13.246: V/SEARCHKEYWORD::(1775): adult
01-29 17:24:13.256: V/TYPE::(1775): business
01-29 17:24:13.286: V/urlstr(1775): http://www.adultretailfinder.com.au/api/search?transport=get&amp;keywords=adult&amp;filter=shops&amp;type=business
01-29 17:24:17.836: D/dalvikvm(1775): GC_CONCURRENT freed 250K, 4% free 11229K/11591K, paused 71ms+74ms, total 174ms
01-29 17:24:18.186: V/JSON(1775): &lt;!DOCTYPE html&gt;n&lt;html&gt;n&lt;head&gt;nn    &lt;!--&lt;meta name="viewport" content="width=device-width; target-densitydpi=device-dpi;"&gt;--&gt;&lt;!--&lt;meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=3.0"/&gt;--&gt;n    &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /&gt;nn    &lt;meta name="HandheldFriendly" content="true" /&gt;n    &lt;!--&lt;meta http-equiv="cleartype" content="on"&gt;--&gt;n    &lt;meta name="format-detection" content="telephone=no" /&gt;n    &lt;meta name="format-detection" content="address=no" /&gt;n    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;nn    &lt;title&gt;Find Adult Shops, Online Shops, Party Plans and Adult Entertainment&lt;/title&gt;n    &lt;meta name="description" content="Adult Retail Finder makes it easy to locate adult shops, online stores, adult party plan and adult entertanment across Australia and New Zealand " /&gt;n    &lt;meta name="keywords" content="Adult Shop, Adult Party Plan, Online Adult Shop, Adult Entertainment, Adult Shop Directory, Adult Directory, Adult Retail Finder " /&gt;n    &lt;link href="/external.css" rel="stylesheet" type="text/css" /&gt;n    &lt;link href="/style.css" rel="stylesheet" type="text/css" /&gt;nn    &lt;script type="text/javascript"&gt;nn        var _gaq = _gaq || [];n        _gaq.push(['_setAccount', 'UA-19656663-32']);n        _gaq.push(['_setDomainName', 'adultretailfinder.com.au']);n        _gaq.push(['_trackPageview']);nn        (function () {n            var ga = document.createElement('script');n            ga.type = 'text/javascript';n            ga.async = true;n            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';n            var s = document.getElementsByTagName('script')[0];n            s.parentNode.insertBefore(ga, s);n        })();nn    &lt;/script&gt;nn    &lt;style type="text/css"&gt;n    #AutoCompleten    {n        background:#FFFFFF;n        color:#000000;n        border:solid 1px #CCCCCC;n        text-align:left;n        position:absolute;n        z-index:10000;n        font-size:12px;n        padding:2px 2px;n    }nn    #ExitAutoCompleten    {n        width:16px;n        height:16px;n        position:absolute;n        z-index:auto;n        cursor:pointer;n    }nn    .AutoItem1 a:linkn    {n        font-size:12px;n        color:#000000;n        text-decoration:none;n    }n    .AutoItem1 a:hovern    {n        font-size:12px;n        color:#000000;n        text-decoration:none;n    }n    .AutoItem1 a:visitedn    {n        font-size:12px;n        color:#000000;n        text-decoration:none;n    }n    .AutoItem1 a:activen    {n        font-size:12px;n        color:#000000;n        text-decoration:none;n    }n    .AutoItem1n    {n        font-size:12px;n        background:#f7f7f7;n        cursor:pointer;n    }nn    .AutoItem2 a:linkn    {n        font-size:12px;n        color:#000000;n        text-decoration:none;n    }n    .AutoItem2 a:hovern    {n        font-size:12px;n        color:#000000;n        text-decoration:none;n    }n    .AutoItem2 a:visitedn    {n        font-size:12px;n        color:#000000;n        text-decoration:none;n    }nn    .AutoItem2 a:activen    {n        font-size:12px;n        color:#000000;n        text-decoration:none;n    }n    .AutoItem2n    {n        font-size:12px;n        background:#FFFFFF;n        cursor:pointer;n    }nn    .AutoItemOvern    {n        font-size:12px;n        background:#ffe8f2;n        cursor:pointer;n    }n&lt;/style&gt;nn&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"&gt;&lt;/script&gt;nn&lt;script type="text/javascript"&gt;nn/*Bob Monteverde*/nString.prototype.width = function(font) {n    var f = font || '12px arial',n            o = $('&lt;div&gt;' + this + '&lt;/div&gt;')n                    .css({'position': 'absolute', 'float': 'left', 'visibility': 'hidden', 'font': f})n                    .appendTo($('body')),n            w = o.width();nn    o.remove();nn    return w;n};nn$(document).ready(function()n{    n   $("#AutoComplete").hide();n $("#ExitAutoComplete").h
01-29 17:24:18.186: V/JSON Parser(1775): Error parsing data org.json.JSONException: Value &lt;!DOCTYPE of type java.lang.String cannot be converted to JSONObject
01-29 17:24:18.196: W/dalvikvm(1775): threadid=11: thread exiting with uncaught exception (group=0x40a13300)
01-29 17:24:18.206: E/AndroidRuntime(1775): FATAL EXCEPTION: AsyncTask #1
01-29 17:24:18.206: E/AndroidRuntime(1775): java.lang.RuntimeException: An error occured while executing doInBackground()
01-29 17:24:18.206: E/AndroidRuntime(1775):     at android.os.AsyncTask$3.done(AsyncTask.java:299)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at java.lang.Thread.run(Thread.java:856)
01-29 17:24:18.206: E/AndroidRuntime(1775): Caused by: java.lang.NullPointerException
01-29 17:24:18.206: E/AndroidRuntime(1775):     at com.adultretailfinder.AdultRetailFinderUtils.getJsonParsedResp(AdultRetailFinderUtils.java:24)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at com.adultretailfinder.SearchListActivity$BGTaskForSearch.doInBackground(SearchListActivity.java:128)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at com.adultretailfinder.SearchListActivity$BGTaskForSearch.doInBackground(SearchListActivity.java:1)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
01-29 17:24:18.206: E/AndroidRuntime(1775):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
01-29 17:24:18.206: E/AndroidRuntime(1775):     ... 5 more
01-29 17:29:18.344: I/Process(1775): Sending signal. PID: 1775 SIG: 9
</code></pre>

<p>Util Class</p>

<pre><code>public class AdultRetailFinderUtils {
    private Context context;
    public AdultRetailFinderUtils(Context mcontext) {

        context = mcontext;

    }

    public ArrayList&lt;AdultRetailFinderDTO&gt; getJsonParsedResp(JSONObject jsonObj) {
        ArrayList&lt;AdultRetailFinderDTO&gt; searchArrayList = new ArrayList&lt;AdultRetailFinderDTO&gt;();
        try {
            JSONArray jsArray = jsonObj.getJSONArray("data");
            if (jsArray.length() &gt; 0) {

                for (int i = 0; i &lt; jsArray.length(); i++) {
                    AdultRetailFinderDTO dto = new AdultRetailFinderDTO();
                    JSONObject jsonObject = jsArray.getJSONObject(i);
                    Integer id= jsonObject.getInt("id") ;   
                    String businessName = jsonObject.getString("business");
                    String type = jsonObject.getString("type");

                    dto.setId(id);
                    dto.setBusinessName(businessName);
                    dto.setType(type);

                    searchArrayList.add(dto);
                }

            }
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        if (searchArrayList.size() &gt; 0) {
            return searchArrayList;
        } else {
            return null;
        }

    }
}
</code></pre>

<p>why?</p>

<p>Thanks in advance!</p>
