When to get view size in fragment with FragmentStatePagerAdapter
===

I wish to implement a gallery using a FragmentStatePageAdapter from the Android Support Library. I know the number of pictures when creating the adapter.

My fragments basically consist of a simple imageView, plus a few TextViews.
To retrieve the image, I wish to know the size of the imageView (is using `MATCH_PARENT` in the layout) so I can request the appropriately sized image from the server.

My problem is, where to request the size of the imageView?
In the `onCreateView` method, the getters for height and width return null and I don't know what to pass in as parameters to `measure(int,int)` to calculate the size correctly. (The results for measure(0,0) on the parent return a measured height/width for the child that is too small.)

In the `onStart` Method of my fragment, the height and width are set correctly for the first 2 fragments that are created, but return 0 for the rest.

Where is the right place to get the layouted height/width for a fragment that is **guaranteed** to be called by the framework?

TIA, Patrick

Code snippet:

    public void onStart() {
		super.onStart();
		
		// Must measure view first
		ImageView imgView = (ImageView) getView().findViewById(R.id.picturefragment_image);

		int height = imgView.getMeasuredHeight(); // FIXME Returns 0 sometimes
		int width = imgView.getMeasuredWidth(); // FIXME Returns 0 sometimes

		if (m_picture.getMaxHeight() != 0) {
			height = Math.min(height, m_picture.getMaxHeight());
		}

		if (m_picture.getMaxWidth() != 0) {
			width = Math.min(width, m_picture.getMaxWidth());
		}
    ... Retrieval of image here ...
    }