Hi, I don't know why it doesn't work, I'm using eclipse version 3.4 and android sdk0.9beta
Actually, I want to get the html code from a website, and it throw to EXCEPETION , unknown error. Then I try a sample code from http://www.anddev.org/working_with_files-t115.html I found that when it runs .getInputStream(), it throw throw to excepetion. 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); } } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---