Tuesday, May 1, 2012

Re: [android-developers] Re: Rendering off UI thread causes ANR on Samsung Note

> I find that difficult to believe. 

I'm very certain of it.  I tested this Activity on 7 devices.  It consistently gives the ANR on the Galaxy Note, and runs fine on all the others.  

> Well, try adding a sleep first and then check your results again. 

Ok, I added Thread.sleep(100) (at the end of every iteration of the while loop), and I still see the ANR.  Any ideas as to why drawing in a non-ui thread would cause the UI thread to become stuck?  

On Tue, May 1, 2012 at 5:02 PM, Miguel Morales <therevoltingx@gmail.com> wrote:
Well, try adding a sleep first and then check your results again.  You can then rule out the CPU consumption there and then.
Otherwise, it indeed may be a bug.  Perhaps that implementation creates a lock or something and lets the UI thread from continuing.
That is the root of the issue, that the UI thread is not able to delegate events and maybe stuck waiting for a lock or executing code.


On Tue, May 1, 2012 at 1:52 PM, Mark Murphy <mmurphy@commonsware.com> wrote:
Redirecting this private reply back to the list, where it belongs:

On Tue, May 1, 2012 at 4:46 PM, Ab <abe.oppenheim@gmail.com> wrote:
> My application renders some in a non-ui thread while the user continues to
> interact with the UI.

That's fine, so long as it does so in such a way as to not hammer the
CPU into oblivion. This is why game developers take steps to manage
their frame rate.

> This simple test Activity mimics this behavior by
> creating a thread which continually paints into a Canvas while the user
> presses the buttons in the UI.
>
> This Activity gives an ANR on the Samsung Galaxy Note within 10-30 seconds,
> but gives no issues on the 6 other devices I tested it on.

I find that difficult to believe.

> Given that the ANR occurs so quickly, and doesn't occur on other devices, I
> don't think the CPU usage is the cause.

You are welcome to your opinion.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

--
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
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--
~ Jeremiah:9:23-24
Android 2D MMORPG: http://solrpg.com/http://www.youtube.com/user/revoltingx

--
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
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
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
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate