An ANR is triggered if the UI thread is blocked for 5 seconds, not 500ms.
On Aug 15, 2012 9:15 PM, "b0b" <pujos.mich...@gmail.com> wrote:

> Interesting discussion but how are we supposed to handle setContentView()
> (which calle the layour inflater, which instantiates views),
> taking a lot of time for complex layouts ?
>
> In ICS+, if  the main UI thread is stuck for more than approx 500ms the
> system great the app with a super aggressive:
>
> 08-15 15:33:24.804: I/dalvikvm(8550): threadid=3: reacting to signal 3
> 08-15 15:33:24.882: I/dalvikvm(8550): Wrote stack traces to
> '/data/anr/traces.txt'
>
> which further slow down app startup (writing on the SD Card take some
> time).
>
> So if setContentView() takes more than 500ms (not an uncommon occurence),
> then the system penalize the app
> even more, writting unwanted stack traces (the app is not ANRing at this
> stage, it is starting).
>
> Since is not safe to call the layout inflater in an AsyncTask to load it
> in the background while displaying some progress display,
> this result in Activities displaying a black screen until  onCreate()
> finishes which may be quite some time if setContentView() cannot be
> executed fast.
>
>
>
>
>
>  --
> 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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to