The LayoutInflater
does not make any assumptions about what thread it runs on. And nothing is mentioned about this in its documentation. Also its code seams to be thread-agnostic.
On the other hand, Views that are created by LayoutInflater
might instantiate Handler
s in their constructors. Well, they probably shouldn't do that, but there is no requirement for them to not create/use Handler
s in their constructors.
My guess is that Samsung Galaxy S had some modifications in its EditText
that somehow triggers creation of Handler
(according to crash log from your other question instance of GestureDetector
was instantiated which in turn created new Handler
). While default implementation doesn't do this.
Overall, I'd say that because there is no explicit requirement for View
s to not use Handler
s and Looper
s in their constructors you can't assume inflating Views from non-UI thread is safe.
You can actually create HandlerThread
and try inflating View
s inside it. But I'd say this is very risky, as in Samsung Galaxy S example the view assumes that this thread will be alive during View
lifetime and will process all messages using its Looper
. Which might result in crash later on.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…