Skip to content

Instantly share code, notes, and snippets.

View sagorbrur's full-sized avatar
🎯
Focusing

Sagor Sarker sagorbrur

🎯
Focusing
View GitHub Profile
SRL = (SwipeRefreshLayout) findViewById(R.id.swiperefresh);
SRL.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
@Override
public void onRefresh() {
Log.i(TAG, "onRefresh called from SwipeRefreshLayout");
// This method performs the actual data-refresh operation.
// The method calls setRefreshing(false) when it's finished.
myUpdateOperation();
}
SRL = (SwipeRefreshLayout) findViewById(R.id.swiperefresh);
SRL.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
@Override
public void onRefresh() {
Log.i(TAG, "onRefresh called from SwipeRefreshLayout");
// This method performs the actual data-refresh operation.
// The method calls setRefreshing(false) when it's finished.
myUpdateOperation();
}
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_refresh"
android:title="@string/menu_refresh"
app:showAsAction="never"
/>
</menu>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.sagorsarker.addingswiprefresh.MainActivity">
<!--refresh layout-->
<android.support.v4.widget.SwipeRefreshLayout