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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:37:39+00:00 2026-05-31T06:37:39+00:00

Hi I have an array adapter that is populated from an array like so:

  • 0

Hi I have an array adapter that is populated from an array like so:

 private class PlacesDetailAdapter extends ArrayAdapter<PlaceDetail> {

    private ArrayList<PlaceDetail> items;

    public PlacesDetailAdapter(Context context, int textViewResourceId, ArrayList<PlaceDetail> items) {


        super(context, textViewResourceId, items);


        this.items = items;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {


        View v = convertView;
            if (v == null) {
                LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = vi.inflate(R.layout.placedetail_list_row, null);
            }
            PlaceDetail o = items.get(position);

            if (!o.getType.equals("place") {
                    TextView tt = (TextView) v.findViewById(R.id.placeDetailTitle_Txt);
                    tt.setText(o.getName());

                    ImageView iv = (ImageView) v.findViewById(R.id.placeDetailIcon_Img);
                    iv.setImageBitmap(o.getImage);

            }
            return v;
    }
}

The problem is that objects with type equal to place are still output as rows.

In addition I try to remove the objects from the array above the IF like so:

Iterator iter = m_orders.iterator();
while(iter.hasNext()){
PlaceDetail vs = (PlaceDetail)iter.next();
if(vs.getType().equals(“place”)) {
m_orders.remove(vs);
}
}

            m_adapter.notifyDataSetChanged();

When I do this, I get a concurrent editing exception.

How I simply limit rows of a certain type from being displayed?

Thanks!

  • 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-31T06:37:41+00:00Added an answer on May 31, 2026 at 6:37 am

    Answering your second question, you’re not allowed to modify a list directly while an iterator is traversing it, as doing so could theoretically cause the iterator to fail in a number of ways (skip elements, get stuck in an infinite loop). There is, however, a remove() method on Iterator that will remove the last item returned from next(), which should do what you want here:

    Iterator iter = m_orders.iterator(); 
    while(iter.hasNext()){ 
        PlaceDetail vs = (PlaceDetail)iter.next(); 
        if(vs.getType().equals("place")) { 
             iter.remove();
        } 
    }
    m_adapter.notifyDataSetChanged();
    

    Another way of approaching your problem might be to define a Cursor that traverses your list, only stopping at the items you want, and then using a CursorAdapter rather than ArrayAdapter. It’s a bit more work, but has the advantage that it doesn’t require any up-front processing, so might be a bit more responsive.

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

Sidebar

Related Questions

I have a ListView with a custom Adapter that extends ArrayAdapter. It's a ArrayAdapter
I have a listview that's populated by rows that get their data from a
I have created a class of type BaseAdapter that is populated with buttons -
I have been implementing a class which class extends ArrayAdapter and implements Filterable. The
I have a class that performs database operations and returns results (array, true, false).
I have a ListView which is populated from a string-array resource. I'm trying to
I have a ListView that is populated with 50 items. This is the xml
I have a spinner with items, populated via ArrayAdapter. I want to change font
I have a listview connected to a custom array adapter. This list shows information
I have an ArrayAdapter powering a ListView . I would like to change the

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.