Error only on the real device. Works on all emulators
<p>I am making an application where it is presented a list of online radios in a listView, this list is obtained thru a MySql database online. I tested my application in all versions of emulators and it worked well. But in the device, the application terminates. When I connect via usb does not close the application, but does not load Json content.</p>

<p>With the device connected via usb debugging does not charge the radios</p>

<p>The log:</p>

<pre><code>03-01 17:35:05.109: E/Buffer Error(2273): Error converting result java.lang.NullPointerException
03-01 17:35:05.109: E/JSON Parser(2273): Error parsing data org.json.JSONException: End of input at character 0 of 
</code></pre>

<p>Below is the code:</p>

<pre><code>import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.apache.http.NameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

public class ListaRadios extends ListActivity {
    private ProgressDialog pDialog;
    JSONParser jParser = new JSONParser();
    ArrayList&lt;HashMap&lt;String, String&gt;&gt; listaradios;
    private static String url_radios = "Url to php mysql connection with";
    private static final String TAG_SUCESSO = "sucesso";
    private static final String TAG_RADIOS = "radios";
    private static final String TAG_ID = "id";
    private static final String TAG_NOME = "nome";

    JSONArray radios = null;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.lista_radios);

        listaradios = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();

        new LoadAllRadios().execute();

        ListView lv = getListView();

        lv.setOnItemClickListener(new OnItemClickListener(){
            public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id_item) {

                String id = ((TextView) view.findViewById(R.id.id)).getText().toString();

                Intent in = new Intent(getApplicationContext(), Player.class);

                in.putExtra(TAG_ID, id);

                startActivityForResult(in, 100);
            }
        });
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main, menu);
        return true;
    }

    private void direciona(Class&lt;?&gt; menu){
        Intent myIntent = new Intent(this, menu);
        startActivity(myIntent);
    }

    public boolean onOptionsItemSelected(MenuItem item) {       
        switch (item.getItemId()) {
            case R.id.contato:
                direciona(Contato.class);
                return true;
            case R.id.sugerir:
                direciona(Sugerir.class);
                return true;
          case R.id.listar:
                direciona(ListaRadios.class);
          return true;
            case R.id.player:
                direciona(Player.class);
          return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == 100) {
            Intent intent = getIntent();
            finish();
            startActivity(intent);
        }

    }

    class LoadAllRadios extends AsyncTask&lt;String, String, String&gt; {
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(ListaRadios.this);
            pDialog.setMessage("Buscando rádios. Aguarde...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(false);
            pDialog.show();
        }

        protected String doInBackground(String... args) {
            List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
            JSONObject json = jParser.makeHttpRequest(url_radios, "GET", params);

            Log.d("Todas as rádios: ", json.toString());

            try {
                // Checking for SUCCESS TAG
                int sucesso = json.getInt(TAG_SUCESSO);

                if (sucesso == 1) {
                    radios = json.getJSONArray(TAG_RADIOS);

                    for (int i = 0; i &lt; radios.length(); i++) {
                        JSONObject c = radios.getJSONObject(i);

                        String id = c.getString(TAG_ID);
                        String nome = c.getString(TAG_NOME);

                        HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();

                        map.put(TAG_ID, id);
                        map.put(TAG_NOME, nome);

                        listaradios.add(map);
                    }
                } else {

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

            return null;
        }

        protected void onPostExecute(String file_url) {
            pDialog.dismiss();
            runOnUiThread(new Runnable() {
                public void run() {
                    ListAdapter adapter = new SimpleAdapter(ListaRadios.this, 
                            listaradios, R.layout.lista_item_radios, 
                            new String[] {TAG_ID, TAG_NOME},
                            new int[] {R.id.id, R.id.nome});
                    setListAdapter(adapter);
                }
            });
        }
    }
}
</code></pre>

<p>php code:</p>

<pre><code>&lt;?php
$resposta = array();
require_once 'db_connect.php';
$db = new DB_CONNECT();

$resultado = mysql_query("SELECT * FROM radios") or die(mysql_error());

if (mysql_num_rows($resultado) &gt; 0) {
    $resposta["radios"] = array();
    while ($row = mysql_fetch_array($resultado)) {
        $radio = array();
        $radio["id"] = $row["id"];
        $radio["nome"] = $row["nome"];
        $radio["site"] = $row["site"];
        $radio["imagem"] = $row["imagem"];
        $radio["url_streaming"] = $row["url_streaming"];
        array_push($resposta["radios"], $radio);
    }
    $resposta["sucesso"] = 1;
    echo json_encode($resposta);
} else {
    $resposta["sucesso"] = 0;
    $resposta["mensagem"] = "Não foram encontradas rádios.";
    echo json_encode($resposta);
}
?&gt;
</code></pre>

<p>What can it be?</p>

<p>If I run the emulator the output of this is below:</p>

<pre><code>03-01 18:41:40.047: D/Todas as rádios:(594): {"sucesso":1,"radios":[{"site":"www.radiomiriam.com.br","id":"1","url_streaming":"http:\/\/69.64.48.96:9880\/","nome":"Radio Miriam","imagem":""},{"site":"www.clarimdopampa.com.br","id":"2","url_streaming":"http:\/\/70.36.96.25:9928\/","nome":"Radio Clarim do Pampa","imagem":""},{"site":"","id":"5","url_streaming":"http:\/\/189.76.158.139:50004\/","nome":"Itapema FM - RS","imagem":""}]}
</code></pre>

<p>But if I run the usb debug output does not list this just this:</p>

<pre><code>03-01 18:48:21.319: I/System.out(3717): Debugger has connected
03-01 18:48:21.319: I/System.out(3717): waiting for debugger to settle...
03-01 18:48:21.519: I/System.out(3717): waiting for debugger to settle...
03-01 18:48:21.719: I/System.out(3717): waiting for debugger to settle...
03-01 18:48:21.919: I/System.out(3717): waiting for debugger to settle...
03-01 18:48:22.119: I/System.out(3717): waiting for debugger to settle...
03-01 18:48:22.319: I/System.out(3717): waiting for debugger to settle...
03-01 18:48:22.519: I/System.out(3717): waiting for debugger to settle...
03-01 18:48:22.719: I/System.out(3717): waiting for debugger to settle...
03-01 18:48:22.919: I/System.out(3717): debugger has settled (1475)
03-01 18:48:23.699: W/System.err(3717): java.net.UnknownHostException: nsi.inf.br
03-01 18:48:23.709: W/System.err(3717):     at java.net.InetAddress.lookupHostByName(InetAddress.java:508)
03-01 18:48:23.709: W/System.err(3717):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:296)
03-01 18:48:23.719: W/System.err(3717):     at java.net.InetAddress.getAllByName(InetAddress.java:258)
03-01 18:48:23.719: W/System.err(3717):     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:136)
03-01 18:48:23.719: W/System.err(3717):     at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
03-01 18:48:23.729: W/System.err(3717):     at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
03-01 18:48:23.739: W/System.err(3717):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:359)
03-01 18:48:23.739: W/System.err(3717):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
03-01 18:48:23.749: W/System.err(3717):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
03-01 18:48:23.749: W/System.err(3717):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
03-01 18:48:23.749: W/System.err(3717):     at com.nsistations.JSONParser.makeHttpRequest(JSONParser.java:62)
03-01 18:48:23.749: W/System.err(3717):     at com.nsistations.ListaRadios$LoadAllRadios.doInBackground(ListaRadios.java:120)
03-01 18:48:23.749: W/System.err(3717):     at com.nsistations.ListaRadios$LoadAllRadios.doInBackground(ListaRadios.java:1)
03-01 18:48:23.749: W/System.err(3717):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
03-01 18:48:23.749: W/System.err(3717):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
03-01 18:48:23.749: W/System.err(3717):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
03-01 18:48:23.749: W/System.err(3717):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
03-01 18:48:23.759: W/System.err(3717):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
03-01 18:48:23.759: W/System.err(3717):     at java.lang.Thread.run(Thread.java:1019)
03-01 18:48:23.759: E/Buffer Error(3717): Error converting result java.lang.NullPointerException
03-01 18:48:23.759: E/JSON Parser(3717): Error parsing data org.json.JSONException: End of input at character 0 of 
</code></pre>
