ViewPager, when are child xml files loaded?
<p>Im using this guide to implement a <code>ViewPager</code>:</p>

<p><a href="http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-horizontal-view-paging/" rel="nofollow">http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-horizontal-view-paging/</a></p>

<p>This is my <code>main.xml</code>:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp"
android:background="@drawable/gradientbg" &gt;

 &lt;android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/viewPager"/&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>My main activity:</p>

<pre><code>@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
setContentView(R.layout.main);

MyPagerAdapter adapter = new MyPagerAdapter();
    ViewPager myPager = (ViewPager)findViewById(R.id.viewPager);
    myPager.setAdapter(adapter);
    myPager.setCurrentItem(1);

    //textviews and other controls that arent located in main.xml will be null for a couple of seconds here
</code></pre>

<p>The viewpager uses 2 child xml files as scrollable content. How do i know when the viewpager is complete so that i can make use of the child control, such as textviews etc?</p>

<p>Hope you get the idea, otherwise ill elaborate. Thanks in advance!</p>

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

public int getCount() {
    return 2;
}

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

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

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

    return view;
}

@Override
public void destroyItem(View arg0, int arg1, Object arg2) {
    ((ViewPager) arg0).removeView((View) arg2);

}

@Override
public boolean isViewFromObject(View arg0, Object arg1) {
    return arg0 == ((View) arg1);

}

@Override
public Parcelable saveState() {
    return null;
}

}
</code></pre>
