Android Question Load xml layout in Inline Java Code

Discussion in 'Android Questions' started by lorebarita, Feb 3, 2015.

  1. lorebarita

    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

  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    It is possible, but I suggest you dont do it unless you have a VERY GOOD reason to do it.
    Erel and NJDude like this.
  3. lorebarita

    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
  4. thedesolatesoul

    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.
    NJDude likes this.
  5. Erel

    Erel Administrator Staff Member Licensed User

    You can use XmlLayoutBuilder library to load XML layouts. Though in most cases it is better to use B4A visual designer when you develop with B4A.
    thedesolatesoul likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice