Suppose there is a standard class:
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstaceState) { super.onCreate(savedInstaceState); setContentView(R.layout.activity_main); } } How to create a general class for activations (Suppose, XMLtemplate.java ), so that depending on the parameter, certain setContentView are loaded into setContentView . For example, when creating an instance of the XMLtemplate class XMLtemplate pass a certain parameter that points to a specific activation (With the main parameter, load R.layout.activity_main , with about -> R.layout.activity_about ):
XMLtemplate xmltemplate = new XMLtemplate(); xmltemplate.param("main"); Not to create a MainActivity or AboutActivity class each time and not to onCreate standard code in the onCreate method.