private void ensureList() {
        if (mGridView != null) {
            return;
        }
        View root = getView();
        if (root == null) {
            throw new IllegalStateException("Content view not yet created");
        }
        if (root instanceof GridView) {
            mGridView = (GridView) root;
        } else {
            View emptyView = root.findViewById(android.R.id.empty);
            if (emptyView != null) {
                if (emptyView instanceof TextView) {
                    mStandardEmptyView = (TextView) emptyView;
                } else {
                    mEmptyView = emptyView;
                }
            } else {
                mStandardEmptyView.setVisibility(View.GONE);
            }
            mProgressContainer = root.findViewById(R.id.progress_container);
            mGridContainer = root.findViewById(R.id.grid_container);
            View rawGridView = root.findViewById(R.id.grid);
            if (!(rawGridView instanceof GridView)) {
                throw new RuntimeException(
                        "Content has view with id attribute 'R.id.grid' "
                                + "that is not a GridView class");
            }
            mGridView = (GridView) rawGridView;
            if (mGridView == null) {
                throw new RuntimeException(
                        "Your content must have a GridView whose id attribute is " +
                                "'R.id.grid'");
            }
            if (mEmptyView != null) {
                mGridView.setEmptyView(mEmptyView);
            } else if (mEmptyText != null) {
                mStandardEmptyView.setText(mEmptyText);
                mGridView.setEmptyView(mStandardEmptyView);
            }
        }
        mGridShown = true;
        mGridView.setOnItemClickListener(mOnClickListener);
        if (mAdapter != null) {
            ListAdapter adapter = mAdapter;
            mAdapter = null;
            setGridAdapter(adapter);
        } else {
            // We are starting without an adapter, so assume we won't
            // have our data right away and start with the progress indicator.
            if (mProgressContainer != null) {
                setGridShown(false, false);
            }
        }
        mHandler.post(mRequestFocus);
    }
Provide the cursor for the grid view.
sherlockprogressfragment/src/com/devspark/progressfragment/SherlockProgressGridFragment.java