Skip to main content

Posts

Showing posts with the label pull down

Android pull down to refresh implementation

There are many apps that allow you to refresh content by simply pulling down the list. I had a similar requirement in one of my projects. I decided to write a blog post that how easily I implemented this feature. For simplicity I will remove code of setting Adapter to ListView etc.I will only show code to detect pull down on ListView First lets see the layout of my screen <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical" >       <!-- this linear layout will contain our content which we will show -->     <!-- to user while refreshing -->     <LinearLayout android:id="@+id/layoutRefresh"         android:orientation="vertical"         android:layout_height="wrap_content"...