This is probably too late for yanki but for anybody else that comes across this page.
I tried it with yanki's code and got the same error as him "error 2". I noticed then that I hadn't updated the manifest file to allow internet permissions.
<uses-permission android:name="android.permission.INTERNET" />
I ran it again and it worked perfectly. So using yanki's code and entering the internet permissions in the manifest file the program should work.