In Android, I'm used to setting layouts with the XML file
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
But you can also set the content using a View in Java
// Create the text view
TextView textView = new TextView(this);
textView.setTextSize(40);
textView.setText(message);
// Set the text view as the activity layout
setContentView(textView);
This has the side effect of not being able to use the layout file any more.
Is there anyway I can programatically set, for example, a text value and still use the layout.xml file?