Remove All Ads from XDA

[Q] Inflate view inside inflated view

3 posts
Thanks Meter: 0
By fjnieto15, Junior Member on 6th May 2014, 12:16 PM
Post Reply Email Thread
Hi, I need to inflate a view with an xml, but inside that view to inflate other view with a different xml. I have tried a lot of things but I'm still not able to achieve what I want :S need some help please...

Here is the code I'm using:
public void setPract(Practica[] _pract, int _code){

    TableLayout table = (TableLayout)findViewById(;
    TableRow row;

    //more stuff...

    for (int k = 0; k < _practLength; ++k) { //_practLength gives the number of subject_practcard.xml I want and is working OK

        LayoutInflater inflater = LayoutInflater.from(VistaAsignatura.this);
        row = (TableRow) inflater.inflate(R.layout.subject_practcard, null, false);

        //xml stuff working OK...


        TableLayout tableGroup = (TableLayout)table.findViewById(;

        for (int j = 0; j < _groupLength; ++j) { //_practLength gives the number of subject_texts.xml I want and is working OK

            TableRow rowGroup = (TableRow) inflater.inflate(R.layout.subject_texts, null, false);

            //more stuff...

            //xml stuff working OK...




So, the problem is that if, for example, _practLength is 3 and _ groupLength is 2 all the three timesm I'm getting al the rowGroup done in the first subject_peccard.xml and not 2 in the first one, 2 in the second one and finally another 2 in the third one.

I'm adding a little scheme so its easier to understand what I'm triying to do:

http:/ /i.stack.imgu aiJY.png

Hope you can help me as I need to make it work :S

Thanks in advance
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes