Tag Archives: Pull To Refresh

pull to refresh android

How to use Pull to Refresh in Listview in Android ? Waiting for the Solution with source code yeah here we come up with this. Lets explore –

Here you can download the updated code with libraries.if not found please comment and give me your email address“.

Download Code

Using Pull to Refresh in Android we going to use external libraries i.e. “Android-PullToRefresh” , “ActionBar-PullToRefresh”. These libraries developed by Chrisbanes. Android-PullToRefresh is no longer maintained by  Chrisbanes so we going to use ActionBar-PullTo Refresh .

This Library is also compatible with “ActionBarSherlock” and it wants minimun API Level 14 . It is also supported with Lower API Levels and I’ll update you later.Lets move on towards tutorial –

Steps –

1). You have to Download two libraries from the given Urls and After downloading both the libraries you have to extract it and then import it to your eclipse. https://github.com/chrisbanes/ActionBar-PullToRefresh https://github.com/castorflex/SmoothProgressBar

2). After importing to your eclipse IDE it will show some errors so you have to solve it but i have already saved your time guyz you just need to download my source code which is working so good and cool .

NOTE –   SO, need not to download any libraries as above i mentioned ,you just need to download my source code and import it .

Here in my project i’have use four java files lets start with –

BaseActivity.java , This class will support all other Views like ListView,ScrollView,WebView. This Class will extend Activity Class and paste the below code in your Java File. BaseActivity.java

Now goto menu folder and create base_menu.xml . It is helpful for showing and hiding the views according to space .

if you are not having a knowledge of Android Menus go through with my Tutorial http://androidarena.co.in/working-on-android-menus-hidden-field/ .


activity_list_view.xml , paste below code in your main xml file i.e Listview . This file shows when your project launches and this is your first activity.

Now open the “ListViewActivity.java” class.This class will extend by BaseActivity. Update your ListViewActivity class according to below code or copy and paste below code your class.


Now you have to create two xml files more i.e. activity_scroll_view.xml and activity_web_view.xml . Paste below code consecutively .


goto the “WebViewActivity.java” class and update your class according to below coding. This class should extends “BaseActivity”  and it should implements “OnRefreshListener”  WebViewActivity.java .

Now create ScrollViewActivity.java and ScrollViewActivity extends “BaseActivity” and implements “OnRefreshListener“. Update your class according to below coding.

Now AndroidManifest.xml file , we need to give INTERNET permission only and make sure you write minimum SDK 14 .

OutPut –

Pull to Refresh Listview     WebView



Now Run your project and scroll it and you will see the loading bar . any suggestions , errors do comment here . enjoy and Happy coding 😛