Hi, I am using eclipse version 3.4 android SDK 0.9Beta.
Actually, I want to get the html from a website. But it throw to exception with unknow error, I found that when it run .getInputStream(), then throw exception. I try a sample from http://www.anddev.org/working_with_files-t115.html, same happen. Here is the code: ----------------------------------- package com.demo.test; import java.net.*; import java.io.*; import org.apache.http.util.ByteArrayBuffer; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class test extends Activity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); /* We will show the data we read in a TextView. */ TextView tv = new TextView(this); /* Will be filled and displayed later. */ String myString = null; try { /* Define the URL we want to load data from. */ URL myURL = new URL( "http://www.anddev.org/images/tut/basic/ getdatafromtheweb/loadme.txt"); /* Open a connection to that URL. */ myString = "before inputStream2"; URLConnection ucon = myURL.openConnection(); /* Define InputStreams to read * from the URLConnection. */ InputStream is = ucon.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); /* Read bytes to the Buffer until * there is nothing more to read(-1). */ ByteArrayBuffer baf = new ByteArrayBuffer(50); int current = 0; while((current = bis.read()) != -1){ baf.append((byte)current); } /* Convert the Bytes read to a String. */ myString = new String(baf.toByteArray()); } catch (Exception e) { /* On any Error we want to display it. */ //myString = e.getMessage(); } /* Show the String on the GUI. */ tv.setText(myString); this.setContentView(tv); } } ------------------------ Pls help ~ Thx so much ! Regards, Ka --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---