Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RecyclerView with load more progressbar at bottom

I tried implementing addOnScrollListener() but this thing fetch data and loading the recycler view from the beginning every time.i want to load the data after the current position.Here is my sample code

 @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_load, null);

        progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
        progressBar.setVisibility(View.VISIBLE);

        myClickHandler();

        business_rv = (RecyclerView) view.findViewById(R.id.business_rv);
        business = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL,false);
        business_rv.setHasFixedSize(true);
        business_rv.setLayoutManager(business);
        if (business_rv.getLayoutManager() instanceof LinearLayoutManager) {
            business = (LinearLayoutManager) business_rv.getLayoutManager();
            business_rv.addOnScrollListener(new RecyclerView.OnScrollListener() {
                @Override
                public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                    super.onScrolled(recyclerView, dx, dy);
                    UpdateRecyclerView(url);
                }
            });
        }

        return view;
    }
like image 728
Muhammed Riyas A V Avatar asked Dec 06 '25 07:12

Muhammed Riyas A V


1 Answers

what you need is endless recycler view ,which will load the data while scrolling . Here I have attached link for that implementation.

Follow this link

like image 156
Mrugesh Thaker Avatar answered Dec 07 '25 21:12

Mrugesh Thaker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!