@Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        /**
         * Create an ArrayAdapter to contain the data for the GridView. Each item in the GridView
         * uses the system-defined simple_list_item_1 layout that contains one TextView. Initially
         */
        mListAdapter = new ArrayAdapter<>(
                getActivity(),
                android.R.layout.simple_list_item_1,
                android.R.id.text1);

        // Set the adapter between the GridView and its backing data.
        mGridView.setAdapter(mListAdapter);

        // Set the empty view so that it is displayed as needed
        mGridView.setEmptyView(mEmptyView);

        // BEGIN_INCLUDE (setup_swipeable_children)
        // Tell the MultiSwipeRefreshLayout which views are swipeable. In this case, the GridView
        // and empty view.
        mSwipeRefreshLayout.setSwipeableChildren(android.R.id.list, android.R.id.empty);
        // END_INCLUDE (setup_swipeable_children)

        // BEGIN_INCLUDE (setup_refreshlistener)
        /**
         * Implement {@link SwipeRefreshLayout.OnRefreshListener}. When users do the "swipe to
         * refresh" gesture, SwipeRefreshLayout invokes
         * {@link SwipeRefreshLayout.OnRefreshListener#onRefresh onRefresh()}. In
         * {@link SwipeRefreshLayout.OnRefreshListener#onRefresh onRefresh()}, call a method that
         * refreshes the content. Call the same method in response to the Refresh action from the
         * action bar.
         */
        mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                Log.i(LOG_TAG, "onRefresh called from SwipeRefreshLayout");

                initiateRefresh();
            }
        });
        // END_INCLUDE (setup_refreshlistener)
    }
The {@link View} which is displayed when the GridView is empty.
SwipeRefreshMultipleViews/Application/src/main/java/com/example/android/swiperefreshmultipleviews/SwipeRefreshMultipleViewsFragment.java