Monday, August 28, 2017

Android Swipe Refresh


This article is about android swipe refresh with simple code.
To add Swipe Refresh we need to add android SwipeRefreshLayout widget under activity_main.xml file


Inside SwipeRefreshLayout we need to put our refresh widget such as ListView,TextView


Then we need to add menu


Now we need to add some code to our MainActivity.java class
First refer our SwipeRefreshLayout
SwipeRefreshLayout SRL;
inside onCreate() Method we need to add this simple code to hadle swiperefresh onClick listener
Here myUpdateOperation() is a method to handle our refresh thing and calls setRefreshing(false) when it’s finished
We need to add same code under OnOptionsItemSelected method
Github Repository Link for example app

No comments:

Post a Comment

Recent Post