Jon anderson
Jon anderson

Reputation: 11

How to use PullToRefresh without RecyclerView in android

I want use PullToRefresh but in my application I don't use recyclerview, and use this widget : android.support.v4.widget.NestedScrollView.
I should set pull to refresh to load new data in my application, how can I it?
Please don't offer to me for use RecyclerView, because I haven't use RecyclerView.
I want use android.support.v4.widget.NestedScrollView .

How can I it?

Upvotes: 1

Views: 193

Answers (1)

jagapathi
jagapathi

Reputation: 1645

Use SwipeRefreshLayout

this.srl1 = (SwipeRefreshLayout) findViewById(R.id.srl);
        if (srl1 != null) {
            srl1.setColorSchemeResources(R.color.red, R.color.green, R.color.blue);
            srl1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
                @Override
                public void onRefresh() {
                    Refresh();
                }
            });
        }

XML CODE

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/srl"
    >



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

Upvotes: 2

Related Questions