Tom, see upstream - it works fine for me now when I launch the polling
thread from the UI thread.  I was launching it from the constructor of
another class, and for some reason this causes issues.  It's quite
reproducible.  If I launch the polling thread from the UI thread it
works.  If I go back to launching it in the constructor it goes back
to being very unreliable.

I assume your example below is being called directly in the UI thread
as you are updating UI objects directly.

On Nov 25, 9:15 am, "Tom Gibara" <[EMAIL PROTECTED]> wrote:
> I just spent a minute knocking out a test case over a cup of tea. Seems to
> work fine for me on WIFI, GPRS, and 3G.
> Tom.
>
> void testConnection() {
> TextView view = (TextView) findViewById(R.id.message);
> HttpURLConnection conn = null;
>     try {
>      URL url = new 
> URL("http://finance.yahoo.com/d/quotes.csv?s=GOOG+T&f=sl1c1p2";);
>         conn = (HttpURLConnection) url.openConnection();
>         conn.setRequestMethod("GET");
>         conn.connect();
>         Reader reader = new InputStreamReader( conn.getInputStream() );
>         StringWriter writer = new StringWriter();
>         for (int c = reader.read(); c >= 0; c = reader.read())
> writer.write(c);
>         view.setText(writer.toString());
>     } catch (IOException e) {
>      Log.e("test", "connection test failed", e);
>     } finally {
>      if (conn != null) conn.disconnect();
>     }
>
> }
>
> 2008/11/25 joshv <[EMAIL PROTECTED]>
>
>
>
> > I can disclose the URL, it's publicly available and always up - yahoo
> > finance csv stock price download.  For example:
> >http://finance.yahoo.com/d/quotes.csv?s=GOOG+T&f=sl1c1p2
>
> > It doesn't get much more highly available than this.  I could test
> > other URLs, but as I have mentionned before, the exact same code, with
> > the exact same URL runs marvelously in the emulator, so I very much
> > doubt it has anything to do with the URL.  It's also not specific to
> > wi-fi on the handset.  I get the same behavior when I disable wi-fi
> > and use only 3G.
>
> > It would take me a bit of work to create a reproducible snippet, no
> > proprietary concerns - just space.  The code snippet I've already
> > posted is simply running in another thread spawned by the UI thread.
> > If I get some time I will try to work on a self-contained demo that
> > reproduces the problem on my handset.
>
> > On Nov 25, 7:02 am, Mark Murphy <[EMAIL PROTECTED]> wrote:
> > > joshvwrote:
> > > > I am really starting to think that there is something wrong with my
> > > > handset.  I certainly have no problem with transient disconnects and
> > > > such resulting from moving from cell to cell, or from 3G to wifi, or
> > > > edge to 3G - but I am sitting 3 feet from a very stable access point.
>
> > > Here's my recommendation on how to proceed:
>
> > > First, create a separate really simple application that uses your
> > > current techniques (URLConnection or HTTPComponents) to access a Web
> > > site. Retrieve a Web page that is a no-brainer
> > > always-gonna-work-for-everyone page, particularly one that is OK for you
> > > to disclose.
>
> > > If this gives you the same symptoms as you're experiencing in your main
> > > application, post the manifest, layout, and activity source code, so
> > > some of us can try it and see if we get problems on our devices.
>
> > > If, however, this simplified example works just fine, start to slowly
> > > convert it to look more like what's giving you problems (e.g., switch to
> > > the actual Web page you're trying to hit instead), and see where the
> > > problems creep in.
>
> > > At the point when you start getting problems again, if your test code is
> > > still safe for public release (e.g., no proprietary information), post
> > > the manifest, layout, and activity source code, so some of us can try it
> > > out and see if we get the same problems.
>
> > > Going all the way back to your original post, the snippet of source you
> > > provided doesn't seem problematic (other than I'm a fan of
> > > HTTPComponents over URLConnection), but, then again, we aren't going to
> > > be able to reproduce your problem with just that snippet.
>
> > > In the end, if we collectively get a reproducible scenario that works,
> > > that sample code should serve us well on the issue tracker to make sure
> > > this gets looked at.
>
> > > --
> > > Mark Murphy (a Commons Guy)http://commonsware.com
>
> > > Android Training on the Ranch! -- Mar 16-20, 2009
> >http://www.bignerdranch.com/schedule.shtml
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to