Hi,

Could you provide the following additional information:

1) SDK version
2) logcat output.
3) check if conn object is null after calling url.openConnection()..

Thanks,
Megha



On Wed, Apr 2, 2008 at 2:24 PM, yizhao <[EMAIL PROTECTED]> wrote:

>
> I posted a similar question in the beginner group but didn't get what
> I was looking for so I'm trying my luck here : ).
>
> I have a simple android app.  In one of the Activity's onCreate()
> method, I have some code to make a http post (this code is tested in
> an independent java program and works):
>
>            URL url = new URL("http://10.0.2.2:8080/GoogleCamAF/
> welcome.action");
>            URLConnection conn = url.openConnection();
>            conn.setDoOutput(true);
>            OutputStreamWriter wr = new
> OutputStreamWriter(conn.getOutputStream());
>            wr.write(""); // sends a blank string
>            wr.flush();
>
> For some reason (I'm not sure if its because I didn't give the app
> enough permission to access the internet, or something else I didn't
> do), this piece of code doesn't work!
>
> I am able to use Android's browser to access this link fine. Does
> anyone know what I'm doing wrong here?
>
> Thanks.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to