consume C# Rest Service from Android
<p>trying to do a simple communication test between my PC and phone (currently testing with emulator)
I have created a c# Rest service that works ok</p>

<p>URL: <a href="http://192.168.1.100:8000/REST/client" rel="nofollow">http://192.168.1.100:8000/REST/client</a>
Result:</p>

<p>
TEST STRING!</p>

<p>I have a Call function in my android app that looks like this:</p>

<pre><code>public void call() 
{ 
    String URL = "http://192.168.1.100:8000/REST/client";
    EditText txt = (EditText) findViewById(R.id.Textbox);
    String Result = "";
    Toast.makeText(Helloworld.this, "STARTING", Toast.LENGTH_SHORT);
    HttpClient hc = new DefaultHttpClient();
    HttpGet request = new HttpGet(URL);
    ResponseHandler&lt;String&gt; handler = new BasicResponseHandler();
    try{
        Result = hc.execute(request,handler);
    }
    catch (ClientProtocolException e) {   
        e.printStackTrace();   
    } catch (IOException e) {   
        e.printStackTrace();   
    } 
    txt.setText(Result);
    Toast.makeText(Helloworld.this, Result, Toast.LENGTH_SHORT);
    hc.getConnectionManager().shutdown();

} 
</code></pre>

<p>i call this from a button,</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            EditText txt = (EditText) findViewById(R.id.Textbox);
            txt.setText("calling!", TextView.BufferType.EDITABLE );
            call();
        }
        });
</code></pre>

<p>few problems, with this code as is, if i run it i dont see any Toast msgs and the textbox isnt updated. if however i remove the call() from the onclick, the textbox is updated. it seems as though the call is hanging, but even if it was, wouldnt i see the text updated anyways?</p>
