0

I want to check the connection status of my localhost web server from my Android code. But i am getting same result "Not Connected" in both Online / Offline cases.

I don't understant how can i do it. I also gave the permission to Internet in Manifest file

Java Code

     try
     {

            HttpClient httpclient = new DefaultHttpClient();

            HttpPost httpPost = new HttpPost("http://10.0.2.2/ABC");

            httpclient.execute(httpPost);

            tt.setText(" Connected to Localhost ");

    }       
    catch(Exception e)
    {

            tt.setText(" Not Connected ");

    }

Manifest File :

<uses-permission android:name="android.permission.INTERNET"/>

This is my above code and please let me know , what could be the solution.

Anshuman Pattnaik
  • 883
  • 3
  • 16
  • 37

0 Answers0