Getting data from PHP in Android
<p>I've seen several tutorials for this, but they're all older than the Android update that prevents network calls in the main thread. I tried moving the code that called it to a RetrieveFeedTask, but that didn't help me, because I then had no way to get the data in my main thread. Here's what I did:</p>

<pre><code>class RetrieveFeedTask extends AsyncTask &lt;String, Void, String&gt;
{

    private Exception exception;

    private String doInBackground()
    {
        String returnString = "sample";

         ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
        //http post
        try{
             HttpClient httpclient = new DefaultHttpClient();
             HttpPost httppost = new HttpPost("http://localhost/sample_array.php");
             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);
               sb = new StringBuilder();
               sb.append(reader.readLine() + "\n");

               String line="0";
               while ((line = reader.readLine()) != null) {
                              sb.append(line + "\n");
                }
                is.close();
                result=sb.toString();
                }catch(Exception e){
                      Log.e("log_tag", "Error converting result "+e.toString());
                }
        //paring data
        int step_num;
        String description;
        try{
              jArray = new JSONArray(result);
              JSONObject json_data=null;
              for(int i=0;i&lt;jArray.length();i++){
                     json_data = jArray.getJSONObject(i);
                     step_num=json_data.getInt("step_num");
                     description=json_data.getString("description");
                 }
              }
              catch(JSONException e1){
                  Toast.makeText(getBaseContext(), "No step found" ,Toast.LENGTH_LONG).show();
              } catch (ParseException e1) {
                    e1.printStackTrace();
            }

        //System.out.println(result);
        return result;
    }

    @Override
    protected String doInBackground(String... arg0) {
        // TODO Auto-generated method stub
        return null;
    }

}
</code></pre>

<p>Then in the main thread, I did this:</p>

<pre><code>AsyncTask&lt;String, Void, String&gt; returnString = new RetrieveFeedTask().execute();
</code></pre>

<p>So how do I get that information to use in the main thread?</p>
