Android Question Load xml layout in Inline Java Code

lorebarita

Member
Licensed User
Hi I do not know if my question is valid but is it possible to load a layout in the inline java code

something like this

setContentView(R.layout.activity_login);
 

lorebarita

Member
Licensed User
Thats cool but what is the danger? If you have a simple example show me I just experiment a little. Just for knowledge in that case
 

thedesolatesoul

Expert
Licensed User
The danger is that you will be sucked into copy/paste programming without understanding it. For e.g. do you know what setContentView does, and when you can call it?

btw, I dont even think there is a lot you need to do to run that code. R class will be generated by B4A with any AdditionalRes. If you import it, you just need a method to call that function.
 
Top