HTTP Client problems

imanewbe

Lurker
Hi

I have just finished watching the Android Application Development Tutorial 147-149. I am trying to get httpclient working but am having no luck.
It crashes on the getInternetData() line. I have added internet permissions. I have tried it using the Emulator and also a Samsung Galaxy SII.
Do I need to do anything else to get this working?
This is what I have:

Code:
package com.cornboyz.thebasics;

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

public class HttpExample extends Activity {

	TextView httpStuff;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.httpex);
		httpStuff = (TextView)findViewById(R.id.txtHttp);
		GetMethodEx test = new GetMethodEx();
		String result;
		try {
			result = test.getInternetData();
			httpStuff.setText(result);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}

Here is the printstack:
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
android.app.ActivityThread.access$600(ActivityThread.java:127)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:4507)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
dalvik.system.NativeStart.main(Native Method)
 
Top