Android Programmatically created Button Persistance

Posted by WtLgi on Stack Overflow See other posts from Stack Overflow or by WtLgi
Published on 2011-01-14T01:47:32Z Indexed on 2011/01/14 1:53 UTC
Read the original article Hit count: 488

Filed under:
|
|

So in an app I'm messing around with I programmatically create some buttons. Then I setContentView(); to a different page. Then if I come back to the original page (on which I placed the programmatically created buttons), they no longer exist. I guess this makes sense as I am calling setContentView(R.layout.main); again which is just the original xml file with no data pointing to the buttons. So is there a way to have the buttons persist over such screen transitions? Thanks.

© Stack Overflow or respective owner

Related posts about android

Related posts about button