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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:54:19+00:00 2026-05-23T05:54:19+00:00

I am creating an ArrayAdapter<String> from a resource array. Then I would like to

  • 0

I am creating an ArrayAdapter<String> from a resource array. Then I would like to delete an item from the list using arrayAdapter.remove(String) method. I find the correct string using arrayAdapter.getItem(int position). But when I call the remove method I end up having UnsupportedOperationException and I have no clue of whats going on.

on 20th June edited
I did the operation that delete from the resource not directly the adapter and notify the adapter about deletion. I was doing the operation on public boolean onContextItemSelected(MenuItem item); after the deletion on this method, I get an

ArrayAdapter.createViewFromResource(int, View, ViewGroup, int) line: 398    

NullPointerException

I think after i delete the item from resources, something is not properly configured..

  • 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-23T05:54:20+00:00Added an answer on May 23, 2026 at 5:54 am

    The ArrayAdapter is rendering the contents in the resource array. You should never be trying to change the contents of the array adapter directly. Instead change the underlying resource array.

    So basically just remove the item from the resource array.

    If you’re working with a list defined like so:

    List<String> resources = YOUR RESOURCE LIST;
    

    You can remove an element with the removeItemAt call:

    resources.removeItemAt(position);
    

    This will work in most cases. In some cases you’ll be working with a list that was modified outside of an activity which is rendering a view of the list. In those cases set the ArrayAdapter’s notifyOnChanged (I think. I don’t have the API reference in front of me) to false… then manually call notifyDataSetChanged.

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

Sidebar

Related Questions

I am creating a list view layout and receive an ArrayAdapter warning. The error
Creating a calculator-like dialog, I noticed that quickly clicking on a button in IE
Creating a table without tbody using javascript createElement/appendChild will not add tbody in Firebug
I have overrode the getView() method in ArrayAdapter . I was wondering if there
Creating the closure is easy but using it is confusing for me. Here is
creating 20 viewcontrollers and calling them one after the other from the mainviewcontroller as
Creating a C# install package and I'd like on completed install for the Program
Creating a watch on a TreeNode , for example, displays an expandable watch item
Creating a popup window from main page with window.open, the child/popup page uses the
I have a ListView than contains a list of image created from web link

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.