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

  • Home
  • SEARCH
  • 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 8775571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:50:06+00:00 2026-06-13T18:50:06+00:00

I searched for this, and tried many things, and for sometime it seemed solved,

  • 0

I searched for this, and tried many things, and for sometime it seemed solved, but it wasn’t

This is my application behaviour:

1. ListView with 1st 10 items fetched from a web server in an AsyncTask, and stored in an ArrayList.

2. Set this ArrayList to the Adapter

3. onScroll, if reached last item, fetch 10 more items, add to the ArrayList and so on

Problem:

There is a button on every item to thank , which has an initial count took from the data of that particular item, from the ArrayList.

let it be 10

Since this is an action item, i had a onClickListener for this button in the getView() in the Adapter.

onClick(){

//change the count to count+1 or change 10 to 11
}

this works but when i scroll the List, this count is set back to count (10) instead of retaining count + 1 (11). This is because the item is being recreated, and the data being used to get count is from the ArrayList, which is old 1 (10). To make this work i need to update the data in the server, get it back and store in the ArrayList and use it to get count + 1 (11).

Is there a way to do this. Because i cant call the server to give me new data every time an action item is clicked. Because this will be something like ListView is recreated, losing all the scrolled items.

Thank You

  • 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-13T18:50:09+00:00Added an answer on June 13, 2026 at 6:50 pm

    If by focused you mean selected (scrolled down by the keyboard, has the selection rectangle around it) then just use setOnItemSelectedListener. The int argument is the position, compare that to the number of items in your list and you’re golden.

    If by focused you mean visible, then use setOnScrollListener, which has this method:

    onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)
    

    Just first + visible will get the last item shown, which you can compare to the total. then write update the adapter with remaining items…

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

Sidebar

Related Questions

I've searched far and wide about this issue, tried many fixes but I cannot
I tried Google this issue and was searched over an hour on Stackoverflow, but
I've searched for help and tried everything on this thread , but still can't
I know this must be a trivial question, but I've tried many different ways,
I've searched Google and this website many times, but can not find a solution
I have tried many queries, but this gets me my OU: (&(objectCategory=organizationalUnit)(Name=MyOU)) (I just
I know this has been asked several times, but I searched and I tried
Searched and found many results and tried everything but couldnt figure it out! Created
I've searched and tried many examples but none seem to work for me. I
Doxygen noob here. I've searched and tried to resolve this for several hours now

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.