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

While creating a file synchronization program in C# I tried to make a method
Creating a document fragment using plain Javascript is dead simple: var docFragment = document.createDocumentFragment();
Creating a website using simple html(not html5) and css but got stock in mouseover
Creating a pacman-like game, where a player eats objects. When a MovieClip (box) eats
Am following the tutorial here on creating a simple todo list app: http://www.mydroid.apnafundaz.com/2010/07/todolist-application-in-android-step-by-step-guide-with-screen-shots/ Have
Creating a voting system just like stackoverflow. Questions like this have been asking several
Creating the permutations of a list or set is simple enough. I need to
Creating my tables from my models.py . I donno how to do 2 things
Creating a zip file using Send To -> Compressed folder excludes .hg folder on
Creating My Windows Form Application and using ADO.Net as Data Access layer and SQL

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.