Answers for "android recyclerview pull to refresh"

0

android recyclerview pull to refresh

public class BooksActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener {

            SwipeRefreshLayout swipLayout;
            RecyclerView recyclerview;

        @Override
            protected void onCreate(@Nullable Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity);
                recyclerview = view.findViewById(R.id.recyclerview);
                swipLayout = view.findViewById(R.id.swipe_layout);
                swipLayout.setOnRefreshListener(this);
            }//end of onCreate

        @Override
            public void onRefresh() {
        //your refresh code here
           loadRecyclerViewData()
             }

        private void loadRecyclerViewData(){
        onSuccess(){
        //don't forget to stop refreshing
        swipLayout.setRefreshing(false);
        }

        onFaliure(){
        //don't forget to stop refreshing
        swipLayout.setRefreshing(false);
        }
    }
    }
Posted by: Guest on October-17-2021
0

android recyclerview pull to refresh

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipe_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/layout_titlebar">

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/layout_titlebar"
        android:layout_margin="5dp"
        />

    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
Posted by: Guest on October-17-2021

Code answers related to "android recyclerview pull to refresh"

Browse Popular Code Answers by Language