开发者

Switch view with a ViewFlipper

开发者 https://www.devze.com 2023-02-08 06:19 出处:网络
When I rund my application I can choose which view to show in my viewFlipper by running: viewFlipper.setDisplayedChild(1);

When I rund my application I can choose which view to show in my viewFlipper by running:

viewFlipper.setDisplayedChild(1);

in onCreate, I c开发者_开发问答an switch the view in my onClick()

viewFlipper.setDisplayedChild(0);

When I want to switch child from my code (not in my main app) i get the following problem!

02-02 12:17:08.620: ERROR/AndroidRuntime(1005): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

Any help is appreciated.


Only call setDisplayedChild() from the main application thread, not from a background thread.

0

精彩评论

暂无评论...
验证码 换一张
取 消