Skip to content Skip to sidebar Skip to footer

I'm Unable To Call A Servlet From My Android Application

This is my android application: package org.me.sampleandroidservlet; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import java.io.Buffered

Solution 1:

Your code is looks incomplete:

try this snippet:

StringserverResponse=""; // it will hold the response returned by the servertry
{
    HttpClient http=newDefaultHttpClient();
    HttpGethttpget=newHttpGet(
         "http://10.0.2.2:8084/SampleWebUser/SampleUser?hello=hi");
    HttpResponseresponse= http.execute(httpget);        

   serverResponse = EntityUtils.toString(resEntity); // Server response/*
         Do your other stuff here.
   */ 
}
catch(Exception ex)
{
    ex.printStackTrace();
}

Post a Comment for "I'm Unable To Call A Servlet From My Android Application"