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

The Archive Base Latest Questions

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

I am working on an app that requires removing items from a ListView on

  • 0

I am working on an app that requires removing items from a ListView on a button event.

I tried to remove it from ArrayList and create the whole new adapter and load the list again. As my list is huge, doing this will affect the performance of my app. So I was wondering if there is any other way by which I could remove an item from my list dynamically.

Edit: I tried what you said.

When I removed one item it worked perfectly, but as I increase the number of selected items it starts giving me IndexOutOfBoundException.

Here’s my code:

public void onClick(View view)
{
    SparseBooleanArray checkedPositions = new SparseBooleanArray();
    checkedPositions.clear();
    checkedPositions = lv.getCheckedItemPositions();
    int size = checkedPositions.size();
    if(size != 0)
    {

        for(int i = 0; i <= size; i++)
        {
            if(checkedPositions.valueAt(i))
            {
                list.remove(notes.getItem(checkedPositions.keyAt(i)));
                notes.notifyDataSetChanged();
            }
        }
    }
        else{}
}

Here, notes is a reference to an object of SimpleAdapter.

  • 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-21T05:31:30+00:00Added an answer on May 21, 2026 at 5:31 am

    Well you just remove the desired item from the list using the remove() method of your ArrayAdapter.

    A possible way to do that would be:

    Object toRemove = arrayAdapter.getItem([POSITION]);
    arrayAdapter.remove(toRemove);
    

    Another way would be to modify the ArrayList and call notifyDataSetChanged() on the ArrayAdapter.

    arrayList.remove([INDEX]);
    arrayAdapter.notifyDataSetChanged();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an iPhone app that requires a basic client/server interaction model. For
I'm currently working on a metro app that requires a few textual resources. Part
I am working on an app which requires that the user be logged in
The App that I'm working on requires to parse a very big Json file
The iPhone app that I am working on requires GET calls to a 3rd
I'm working on a django app for a site that requires an image gallery.
I'm working on a app that requires a DB and I'm getting some problems,
I'm working on an app that requires a particular barcode true type font that
I'm working on a web app that reads data from a set of text
I'm currently working on an iPhone app that requires the user to accept a

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.