Code example for DefaultHttpClient

Methods: execute

0
                    try { 
                        // Note: not using AndroidHttpClient, as that comes with its 
                        // own pre-StrictMode network-on-Looper thread check.  The 
                        // intent of this test is that we test the network stack's 
                        // instrumentation for StrictMode instead. 
                        DefaultHttpClient httpClient = new DefaultHttpClient();
                        HttpResponse res = httpClient.execute(
                            new HttpGet("http://www.android.com/favicon.ico"));
                        Log.d(TAG, "Fetched http response: " + res);
                    } catch (IOException e) {
                        Log.d(TAG, "HTTP fetch error: " + e);
                    } 
                } 
            }); 
 
        final Button http2Button = (Button) findViewById(R.id.http2_button);
        http2Button.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    try { 
                        // Usually this ends up tripping in DNS resolution, 
                        // so see http3Button below, which connects directly to an IP