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 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 am working for a client on a web app that requires localization in
I am working on an app that will show reverse view from camera. For
I've created a simple Facebook app that doesn't need any data/info from users. When
I'm working on an app that lets users select regions by finger painting on
I've got an app that uses Sql CE 3.5 SP2. I've included the DLL's
I have an application that requires the use of a mootools calendar, however, I
I am trying to attach files in my RoR app. I am using Rails
Can anyone suggest a fast , efficient method for storing and accessing a sparse
My grid isnt showing data when put to tab. This grid, store, model, JSON
Ok I am near wits end here. I've got a simple MVC3 application with

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.