Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8954315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:17:49+00:00 2026-06-15T14:17:49+00:00

I have implemented a list view, every user scroll to bottom screen, it auto

  • 0

I have implemented a list view, every user scroll to bottom screen, it auto add new data to list view
Once the scroll has completed, onScroll() call for every new item that enters the displaying view, from the beginning to the end of the scrolling.

lv_best = (ListView) findViewById(R.id.lv_best);
bestadapter = new LazyAdapter(this, lst_tab_best);
lv_best.setAdapter(bestadapter);
lv_best.setOnScrollListener(new AbsListView.OnScrollListener() {

    @Override
    public void onScrollStateChanged(AbsListView view, int scrollState) { }

    @Override
    public void onScroll(AbsListView view, int firstVisibleItem,
                        int visibleItemCount, int totalItemCount) {

    Log.d("onScroll ", firstVisibleItem+"-"+visibleItemCount+"-"+totalItemCount);
    boolean loadMore = firstVisibleItem + visibleItemCount >= totalItemCount;
    if(loadMore){
            new ChangeTab_best().execute();
     }
     }
    });

I run in emulator, list above display with 5 items
but I can’t detect the end of scrolling in a ListView, ChangeTab_best() is called many time.When I see Logcat android , all variables firstVisibleItem,visibleItemCount,totalItemCount always equal 0

So what’s happen here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:17:49+00:00Added an answer on June 15, 2026 at 2:17 pm

    To detect the item at the bottom of the screen you have to work with firstVisibleItem and visibleItemCount. I had created a demo example for the same using AsyncTask that will loading items in background and update the UI.

    Total of firstVisibleItem and visibleItemCount will give you the number of items that are loaded and then you can implement the logic of loading more items.

    int loadedItems = firstVisibleItem + visibleItemCount;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a list view. Each item in my list view has two
i have implemented a list view its working fine but when i click on
I have used SimpleCursorAdapter for display the data into a list in my activity
I have a problem with my shoping list application. I implemented a button adapter
I have a listView. In that listView i have implemented onTouchListener. Every things work
I have created an audio player with a list view of songs, when the
I have implemented custom view with some children. The view can be scrolled using
I'd like to implement a ListView that will have a list of SelectedItems as
I have to implement a one linked list but it should put object in
I have a Linked List and I want to implement a function: Random_Shuffle_List (struct

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.