Sending information to API using Android
<p>I am trying to contact an API and get the response. As part of my debugging I want to insure that the response is being recorded, it should be an xml response.</p>

<p>Here's what I have:</p>

<p>public class http extends Activity {</p>

<pre><code>public void httpMethod(){
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://site.com/api/");

    try {
        // Add your data
        List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2);
        nameValuePairs.add(new BasicNameValuePair("apikey", "0d4e122d20"));

        nameValuePairs.add(new BasicNameValuePair("ip", "65.82.126.103"));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httppost);

    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
    } catch (IOException e) {
        // TODO Auto-generated catch block
    }

   TextView myTextView = (TextView) findViewById(R.id.myTextView);
   myTextView.setText(response);
}
}
</code></pre>

<p>I'm trying to see the response that I get, however the variable response in the line</p>

<pre><code>myTextView.setText(response)
</code></pre>

<p>is throwing an error:</p>

<pre><code>response cannot be resolved to a variable
</code></pre>

<p>is response not truly a variable of the type httpresponse? what's going on here...?</p>
