Can't reference to id's created with inflate in pager
<p>I've made a pager in my application like this</p>

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

    public int getCount() {
        return PAGER_VIEWS;
    }

    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.time;
            break;
        case 1:
            resId = R.layout.holder;
            break;
        }

        View view = inflater.inflate(resId, null);

        ((ViewPager) collection).addView(view, 0);

        return view;
    }
</code></pre>

<p>Also in my application i have the ability to create widgets which is setup like here
<a href="http://stackoverflow.com/questions/11473757/hosting-widgets-in-an-android-launcher">Hosting widgets in an android launcher</a></p>

<p>Everything works fine if i add a widget to a linearLayout in my main xml, but now i would like to create the widget inside the inflated layout from the pager ( R.layout.holder), but it doesn't work. My application crashes.</p>

<p>N.B this doesn't happend with widgets only, i can't even do a setText of textViews made with the inflate</p>

<p>How can i overcome this problem?</p>
