I have one activity, off this I have two classes.
When my app starts I setContentView to a layout that is in one of my classes.
Now inside this layout there is a button which needs to setContentView to the layout that is in my other class.
How can I change the content view? How can my subclass send a message back to my main class to tell it to change the setContentView?
“off this I have two classes” are they subclasses to your activity, inner classes? Your problem is not really apparent to me.
The way I would do that is have two XML layouts and two activities:
layout1andlayout2,Activity1andActivity2.You call
setContent(R.layout.layout1)normally in youronCreatemethod inActivity1, and you add the following code in your button onClick method: