On Thu, Dec 4, 2008 at 2:25 PM, Justin (Google Employee) <[EMAIL PROTECTED]> 
wrote:
>
> My guess is that you're calling Thread.run() from the UI thread. This
> will execute the thread in the UI thread. You need to call Thread.start
> () for it to execute in its own thread.

No, I'm definitely calling .start (), and it's definitely running as a
background
thread otherwise doing the same thing with a little post data and lots
of post response wouldn't work either. That's why I don't understand this
because it seems to correlate with the writing of http post data and nothing
else. Which doesn't make any sense to me.

Mike
>
> Let me know if this isn't the issue.
>
> Cheers,
> Justin
> Android Team @ Google
>
> On Dec 4, 1:33 pm, enervatron <[EMAIL PROTECTED]> wrote:
>> Hi all,
>>
>> I'm using a helper thread to post data back to a web site. What I
>> notice is that I'm
>> getting an Application Not Responding back in the main thread even
>> though it's
>> not doing anything other than interrupting the helper thread to wake
>> up. If the
>> amount of data in the post is small (~ couple hundred bytes), I don't
>> have a
>> problem, but when it gets moderately large (~ 10kb) it reliably stalls
>> the main
>> UI thread and gets (appropriately) an ANR. Even weirder is that if I
>> time from
>> when I start the post to when it receives the entire reply (ie, using
>> Date().getTime())
>> in the helper thread, it shows that it's only taking about .5 seconds
>> to complete,
>> even though it  takes ~10 seconds to become responsive again.
>>
>> This *only* seems to be the case writing the post data. If I do a post
>> of a small
>> amount of data with a large amount of data coming back from a web
>> site, the
>> app remains responsive and unlike the above problem, the timing
>> numbers in
>> the thread agree with how long it actually took.
>>
>> FWIW, I'm using HttpURLConnection to create and read/write the data,
>> and
>> I'm aware that I need to use Handler to affect the UI from the helper
>> thread.
>> Also: this is on the G1 hardware. I've also fiddled with priorities,
>> etc, to
>> no avail, so I'm pretty stumped as to why the helper thread is
>> interacting
>> with the UI thread.
>>
>> Mike
> >
>

--~--~---------~--~----~------------~-------~--~----~
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