2

I have to implement android swipe up to refresh listview. I got sample code from here. But in this code it is swipe down to refresh listview. And I want it in swipe up to refresh listview. If anyone know answer then please explain or suggest me link from where I can understand from beginning. Thank You.

Harshad
  • 99
  • 2
  • 9

3 Answers3

4

Please Use

Link Library for scrolling bottom/Up by setting direction.

You can use other SO links too

SwipeRefreshLayout - Pull From Bottom

Community
  • 1
  • 1
Amarjit
  • 4,327
  • 2
  • 34
  • 51
  • [Please avoid link-only answers](http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers/8259#8259) – 2Dee Sep 04 '15 at 11:58
  • sure'll take care next time :) – Amarjit Sep 04 '15 at 12:10
0

You can use SwipeRefreshLayout,The layout you need to refresh should give inside this layout.

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

  <!--layout which should be refreshed should come here-->

      <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"></ListView>

       </android.support.v4.widget.SwipeRefreshLayout>

   </RelativeLayout>

You can see the complete implementation at Android swipe to refresh listview layout

Ramees
  • 68
  • 4
  • 16
-2

Previously we used to implement a custom swipe view to detect the swipe down. But android made our day easier by introducing SwipeRefreshLayout in android.support.v4 to detect the vertical swipe on any view.

Below link shows show step by step procedure

http://www.androidhive.info/2015/05/android-swipe-down-to-refresh-listview-tutorial/

slama007
  • 1,273
  • 2
  • 18
  • 34