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.
加载中,请稍侯......
精彩评论