My app consists of different activities where I use a SwipeRefreshLayout to refresh data in listViews by swiping. When this happen a refresh icon is displayed at the top of the screen. 
However, for 2 other specific activities that contain no list view, I only want to display the refresh icon while the data is refreshing by using pullToRefresh.setRefreshing(true); & pullToRefresh.setRefreshing(false);. I don't need to use it for swiping.
This is how it looks in my list view layout xml file:
<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/pullToRefresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ListView
        android:id="@+id/ListView"
        android:dividerHeight="8dp"
        android:divider="#000000"
        android:layout_below="@+id/feedLinearLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
 
                        
Use
SwipeRefreshLayoutas a regular layout, and callpullToRefresh.setRefreshing(true)when you want to show the loading wheel, andpullToRefresh.setRefreshing(false)to hide it.