Http request using android requesting for a php page in local host
<p>I am creating an android application that needs to interact with a local web server(WAMP). WAMP has a php file that just echos Hello world. This application requests for this page but when I run the application and click on the button that fires the request event, there are no results printed on the EditText saying Helloworld. The following is the code:</p>

<pre><code>package com.mobilevoter;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URLConnection;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class mobilevoter extends Activity implements OnClickListener {
    Button proceed;
    EditText voter_number;
    EditText id_number;
    URLConnection conn;
    BufferedReader myreader;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        proceed=(Button)findViewById(R.id.proceed_btn);
        voter_number=(EditText)findViewById(R.id.editText_voternumber);
        id_number=(EditText)findViewById(R.id.editText_idnumber);
        proceed.setOnClickListener(this);
    }
    @Override
    public void onClick(View src) {

            if(src==proceed){
                HttpClient authenticationClient= new DefaultHttpClient();
                HttpPost url_post=new HttpPost("http://10.0.2.2/practice/index.php");
                HttpResponse response;
                try
                {
                response=authenticationClient.execute(url_post);
                HttpEntity authenticationEntity=response.getEntity();
                InputStream authenticationStream=authenticationEntity.getContent();
                BufferedReader myreader=new BufferedReader(new InputStreamReader(authenticationStream));
                String inputStream;
                while((inputStream=myreader.readLine())!=null)
                {
                    voter_number.setText(inputStream);
                }
                }
                catch(Exception exception)
                {
                    System.out.println(exception.getMessage());
                }
                /*finally
                {
                    try
                    {
                    myreader.close();
                    }
                    catch(IOException ioexception)
                    {
                        System.out.println(ioexception.getMessage());
                    }
                }*/

            }
    }
}
</code></pre>

<p>The manifest looks like this:</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.mobilevoter"
      android:versionCode="1"
      android:versionName="1.0"&gt;
    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
        &lt;activity android:name=".mobilevoter"
                  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;/application&gt;
    &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
&lt;/manifest&gt;
</code></pre>

<p>I will really appreciate the help. Thanx.</p>
