I want to add a button programmatically from the java code rather than adding it from the XML file. How can I do that?
Asked
Active
Viewed 35 times
1 Answers
0
First step is to instantiate button inside onStart(), later add the instantiated button to the ComponentContainer or setUIContent();
@Override
protected void onStart(Intent intent) {
super.onStart(intent);
Button button = new Button(MainAbilitySlice.this);
setUIContent(button);
}

Gowtham GS
- 478
- 2
- 5