0

I have a "Tools.java" that shows "tools.xml" correct? Within this "tools.xml" RelativeLayout have a layout id = @+/contentLayout that is empty.

And I have several other activits "tool1.java", "tools2.java" ... that shows "tool1.xml", "tool2.xml" ...

How to call the class "tool1.java" for example and have it show the "tool1.xml" within the RelativeLayout that is in "tools.xml"

Thanks

GDawson
  • 3
  • 1
  • 6

1 Answers1

0

check out this

// this is you relativelayout from tool.xml
    RelativeLayout relativeLayout = (RelativeLayout )findViewById(R.id.contentLayout);

    LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);



                  // tool1 is your tool1.xml
            View tool1 = inflater.inflate(R.layout.tool1, null,false);

                // here add tool1 to tool.xml in relativelayout
            relativeLayout.addView(tool1 );
Ravi1187342
  • 1,247
  • 7
  • 14