All,

I found the problem, after I added code to read the response,
everything started working.  It might have to do with the fact that
the webapp is implemented using WebWorks, I'm not sure...

The code I added is:
            BufferedReader rd = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
            String line;
            while ((line = rd.readLine()) != null) {
                Log.i( TAG, line );
            }
            wr.close();
            rd.close();


On Apr 2, 9:51 pm, guzarva <[EMAIL PROTECTED]> wrote:
> On Apr 3, 4:24 am, 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