开发者

switching between views

I am trying to make my app view multiple views I made 2 xml files (main, sub) and I switch between them using :

setContentView(R.Layout.main);

setContentView(R.Layout.sub);

When I switch to the sub, it switches fine. However, When I switch back to main, the app crashes and I have no clue why it did that.

开发者_运维问答The only line that seems to make it crash is the calling of setContentView(R.Layout.main); for the second time. any clue on that ?


You should provide the logcat output so that we can know what the problem is. However, I'd recommend to use something like ViewFlipper instead of switching views using setContentView.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜