pagerAdapter reference a programmed layout android
<p>I'm usually use pager adapter to scroll through different layouts, but this time my layouts were created with java code instead of xml. Normally when choosing the resource id I reference R.layout.file. Having created the layout with java code, I'm not aware how to reference the resource. Does anyone know how to do this?</p>

<p>Sample code of a layout I created that I want to reference:</p>

<pre><code>LinearLayout ParentLayout = new LinearLayout(getApplicationContext());
ParentLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
ParentLayout.setOrientation(LinearLayout.VERTICAL);
</code></pre>

<p>Normally for a pager adapter I have something like this:</p>

<pre><code>public class MyPagerAdapter extends PagerAdapter {


@Override
public int getCount() {
    return 3;
}

public Object instantiateItem(View collection, int position){
    LayoutInflater inflater = (LayoutInflater) collection.getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

     int resId = 0;
     switch (position) {
     case 0:
         resId = R.layout.xmlfile1; //I want to reference the ParentLayout I created above
         break;
     case 1:
         resId = R.layout.xmlfile2;
         break;
     case 2:
         resId = R.layout.xmlfile2; 
         break;

}
     View view = inflater.inflate(resId, null);
     ((ViewPager) collection).addView(view, 0);
     return view;
}

...

}
}
</code></pre>
