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 7693183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:01:29+00:00 2026-05-31T21:01:29+00:00

I’m attempting to add items to an adapter as the user scrolls to the

  • 0

I’m attempting to add items to an adapter as the user scrolls to the bottom of the list. I am able to do this, however I want to add the new items to the adapter and keep the items that were already there, but as it is now the original items are removed and only the new ones are visible. Any ideas as to how I can achieve this?

This is what my code looks like atm:

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

        if (loading) {      
            if (totalItemCount > previousTotal) {
                previousTotal = totalItemCount;
                loading = false;
                previousTotal = totalItemCount;
                currentPage++;
            }
        }
        if (!loading
                && ((firstVisibleItem + visibleItemCount) >= totalItemCount)) {
            if (fragmentMode == 5) {
                ActiveUser.getInstance().FetchVidPage(currentPage, chanID,
                        activity, this);
                loading = true;
            }
        }
}

@Override
public void onTaskFinished() {
    titles.addAll(ActiveUser.getInstance().getWebVidInfo(1));
    thumbs.addAll(ActiveUser.getInstance().getWebVidInfo(2));
    data.addAll(ActiveUser.getInstance().getWebVidInfo(3));
    describtions.addAll(ActiveUser.getInstance().getWebVidInfo(4));
    vidOwnerIDs.addAll(ActiveUser.getInstance().getWebVidInfo(4));

    notifyDataSetChanged();

}

Just to clearify what I’m doing; Once the bottom of the list is visible I start an AsyncTask that fetches more videos. In the asynctask I set the adapter as a listener for an event thats fired once the asynctask is finished – this works.

onTaskFinished() the last method above – here I add the new items to 4 lists which the adapter uses to fill out each list item with, and finally I notify the adapter.

So the new items are all added fine, the problem is that the items that were in the before the new ones were added, are for some reason removed, or not visible anymore.

Forgot to add that I have verified that the length of the lists does increase, meaning it does contain both the original data and the newly added

Any ideas?

[EDIT] Adding code of where i set the adapter to the listview

        adapter = new LazyAdapter(getActivity(), ActiveUser.getInstance()
                .getWebVidInfo(3),
                ActiveUser.getInstance().getWebVidInfo(1), ActiveUser.getInstance()
                        .getWebVidInfo(2),
                ActiveUser.getInstance().getWebVidInfo(5), ActiveUser.getInstance()
                        .getWebVidInfo(4), CHAN_ID, FRAGMENT_MODE);
        listing.setAdapter(adapter);
        listing.setOnScrollListener(adapter);
  • 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-05-31T21:01:30+00:00Added an answer on May 31, 2026 at 9:01 pm

    Answering my own question.

    Turns out the problem was my lack of understanding of what the notifyDataSetChanged() does. It invokes the adapter being recreated with the same constructor parameters as when it was initially created. So me adding the new items to the adapters internal lists had no effect whatsoever. Instead I needed to make sure that the lists that were parsed to the adapter through its constructer contained all the items.

    So while my method before did get the adapter’s internal lists to contain new and old data, the totalItemCount of the adapter wasn’t updated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.