SwipeRefreshLayout Got ACTION_MOVE event but don't have an active pointer id

Viewed 2948

I am using SwipeRefreshLayout with AppCompat ListFragment. It seems to work fine when I pull to refresh but sometimes in the log I can see the following error. This happens if I pull the list again while it is refreshing or just finished refreshing.

E/SwipeRefreshLayout: Got ACTION_MOVE event but don't have an active pointer id.

Code for my layout is:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

    <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/activity_main_swipe_refresh_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ListView
                android:id="@id/android:list"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:overScrollMode="never"
                />
    </android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>

In the ListFragment I override onCreateView

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    View view = inflater.inflate(R.layout.list_layout, container, false);


    swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.activity_main_swipe_refresh_layout);
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            log.d("swipeRefreshLayout onRefresh");
            onRefreshList();
        }
    });

    adapter = new ItemAdapter(getActivity());
    setListAdapter(adapter);
    return view;
}
1 Answers

Try to put this code after you initialize swipeRefreshLayout

swipeRefreshLayout = (SwipeRefreshLayout)view.findViewById(R.id.activity_main_swipe_refresh_layout);
// put the code below
swipeRefreshLayout.post(new Runnable() {
    @Override
    public void run() {
        swipeRefreshLayout.setRefreshing(true);
        onRefreshList();
    }
});

swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
    @Override
    public void onRefresh() {
        log.d("swipeRefreshLayout onRefresh");
        onRefreshList();
    }
});
Related