log에 URL에서 가저온 정보를 받아서 Log에 뿌리는 내용인데..
DDMS에서는
thread attach failed 라는 내용만 ..
-----------------------------------------------
package pkg.SunHttp;
import java.io.InputStream;
import java.net.URL;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
public class SunHttpActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
http();
}
public void http(){
try{
URL text = new URL("http://www.androidpub.com/");
InputStream isText=text.openStream();
byte[] bText = new byte[250];
int readSize=isText.read(bText);
Log.i("Net","!!!!!!!!!!!!!!!!!!!!!");
Log.i("Net","readSize = "+readSize);
Log.i("Net","bText = "+ new String(bText));
TextView text1 = new TextView(null);
text1=(TextView)findViewById(R.id.text1);
text1.append("!!!");
text1.append(new String(bText));
isText.close();
}catch(Exception e){
Log.e("Net","Error on network call e");
}
}
}