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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:49:04+00:00 2026-05-20T04:49:04+00:00

I want to have a Button that when clicked, removes all the checked items

  • 0

I want to have a Button that when clicked, removes all the checked items in the ListView. I already have all the xml items set up, I just don’t know how to write the java code.

  • 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-20T04:49:04+00:00Added an answer on May 20, 2026 at 4:49 am

    The ListView displays data that comes from an Adapter. In order to remove items from the view the item needs to be removed from the Adapter and the view notified. In android the Adapter notifies the view by calling notifyDataSetChanged().

    How to remove an item from the adapter depends on your particular adapter. The SimpleCursorAdapter gets its data from an underlying Cursor. To remove an item, the item should be removed from the underlying Cursor. For example using a SQLiteCursor a row in the database needs to be deleted.

    If you use the ArrayAdapter just call remove(T object) on the adapter. It will automagically call notifyDataSetChanged() for you.

    update:
    I saw the code at git hub. Here are some pointers as how to get your app working as soon as possible.

    Try refactoring your code in to smaller graspable parts. Start with extracting some methods to give parts of the large method understandable names.

    The problem is that there might by hundreds of rows in the database and only enough views to fill the screen. Nowhere is it remebered what rows are checked, hence its not possible to remove them. You probably need to extend BaseAdapter or SimpleCursorAdapter to hold the state (checked or not) of the rows. Read up on the excellent android documentation.

    My point here is there is a distinction between the view, your CheckBox, and the model containing the data to display. So check out Model-View-Controller. You can ignore the concept of controller for now.

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

Sidebar

Related Questions

I have a Login button that I want to be disabled until 3 text
I want to have a button on my toolbar that has a little down
Here's the scenario: I have a set of buttons that I want to bind
I have the following markup, and I want to make the All radio button
I want to have a select-only ComboBox that provides a list of items for
I have a datalist control which some controls(ex: button) are in it. I want
I have a CALayer with some image contents. When a button touched, I want
I have some buttons that when clicked, invoke jQuery to remove and replace their
I have several wpf pages with update/delete/add buttons. I want to display to the
I want to double buffer a custom control which contains buttons. I have tried

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.