exception reading http Stream
<p>The code pasted below gets an exception on tha line that says...
InputStream in = new BufferedInputStream(urlConnection.getInputStream());<br>
It's an IO exception that says: java.net.UnknownHostException: www.android.com</p>

<p>I checked and that is a valid url.  I got the original code from the android docs on HttpURLConnection although I had to fix serveral bugs in the docs code.</p>

<p>Why am I getting this exception?
thanks,
Gary</p>

<pre><code>import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

import android.app.Activity;
import android.os.Bundle;

public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        HttpURLConnection urlConnection = null;

            try 
            {
                URL url = new URL("http://www.android.com/");   
                urlConnection = (HttpURLConnection) url.openConnection();
                InputStream in = new BufferedInputStream(urlConnection.getInputStream());     
                readStream(in);
            } 
            catch (MalformedURLException e) 
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } 
            catch (IOException e) 
            {   
                e.printStackTrace();
            }  

            finally 
            {     
                urlConnection.disconnect();   
            } 
    }       
</code></pre>
