Reputation: 7407
I want to have an android activity that in general will recursively call the same activity until I set an attribute "status = something"... So I want when the activity starts , to have a different layout (enable couple of buttons that I don't want to be visible from the start of the application). Is it possible to load differrent layout.xml? Or will this be done only by java code?
Upvotes: 1
Views: 146
Reputation: 34156
Calling a lot of activities over and over is probably a bad thing. Why not add buttons to a layout programatically (using java) when you are ready to have the buttons?
Make a layout where you will put them and give it an android:id, find that layout by id (findViewById()) and then add buttons to it- layout.addView(new Button());
Add the buttons when you set the attribute, in the same action so it will happen at the same time.
Upvotes: 0
Reputation: 11230
Doing it in Java is a better option. Though you could do a different setContentView() depending on the value of the status variable
Upvotes: 0