What problems do you encounter?
Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Sep 14, 2:48 am, Carmen Lau <ivancar...@gmail.com> wrote: > package com.example.helloandroid; > > import java.io.IOException; > import java.io.InputStream; > > import android.app.Activity; > import android.os.Bundle; > import android.widget.TextView; > > import org.apache.http.HttpResponse; > import org.apache.http.HttpStatus; > import org.apache.http.client.*; > import org.apache.http.client.methods.*; > import org.apache.http.impl.client.DefaultHttpClient; > //import org.apache.http.util.EntityUtils; > > public class HelloAndroid extends Activity { > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > > try > { > HttpClient hc = new DefaultHttpClient(); > HttpGet get = new HttpGet("http://www.yahoo.com"); > HttpResponse rp = hc.execute(get); > > if(rp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) > { > //String str = EntityUtils.toString(rp.getEntity()); > InputStream is = rp.getEntity().getContent(); > String str = is.toString(); > > TextView tv = new TextView(this); > tv.setText(str); > setContentView(tv); > > } > else > { > System.out.println("halo,baby."); > } > }catch(IOException e){ > return; > } > } > > } > > the above is my code. > but it seems there are some problems here. > So, Anyone can give me some ideas on it? > Thank you. > > Carmen Lau --~--~---------~--~----~------------~-------~--~----~ 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 android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---