Nico wrote:
> Hi,
> I need to replace the current View (set by the activity.setContentView
> method) by an other.
> When I call activity.setContentView two times, I get this exception :
> 01-21 14:13:54.747: WARN/System.err(1156): android.view.ViewRoot
> $CalledFromWrongThreadException: Only the original thread that created
> a view hierarchy can touch its views.
> 01-21 14:13:54.757: WARN/System.err(1156):     at
> android.view.ViewRoot.checkThread(ViewRoot.java:1849)
> 01-21 14:13:54.757: WARN/System.err(1156):     at
> android.view.ViewRoot.requestLayout(ViewRoot.java:455)
> 01-21 14:13:54.767: WARN/System.err(1156):     at
> android.view.View.requestLayout(View.java:6575)
> 01-21 14:13:54.767: WARN/System.err(1156):     at
> android.view.View.requestLayout(View.java:6575)
> 01-21 14:13:54.777: WARN/System.err(1156):     at
> android.view.View.requestLayout(View.java:6575)
> 01-21 14:13:54.777: WARN/System.err(1156):     at
> android.view.ViewGroup.removeAllViews(ViewGroup.java:2033)
> What is problem ?

As the exception says: "Only the original thread that created
a view hierarchy can touch its views".

Are you attempting to call setContentView() from a background thread? If
so, arrange to call it on the UI thread, via post(), runOnUiThread(), or
a Handler.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android Training in Sweden -- http://www.sotrium.com/training.php

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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