March 2016
Intermediate to advanced
428 pages
9h 2m
English
Pulling down a list to indicate a manual refresh is known as the Swipe-to-Refresh gesture. It's such a common feature that this functionality has been encapsulated in a single widget called SwipeRefreshLayout.
This recipe will show how to use the widget to add Swipe-to-Refresh functionality with a ListView. The following screenshot shows the refresh in action:

Create a new project in Android Studio and call it: SwipeToRefresh. Use the default Phone & Tablet options and select Empty Activity when prompted for the Activity Type.
First, we need to add the SwipeRefreshLayout widget and ListView to the activity ...
Read now
Unlock full access