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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:36:13+00:00 2026-06-14T17:36:13+00:00

I have extended ArrayAdapter for my custom class. My class overrides toString() and returns

  • 0

I have extended ArrayAdapter for my custom class. My class overrides toString() and returns the field which i want to use for search queries.

This is my filter code:

productItemAdapter.getFilter().filter(filterText.toLowerCase());

this is my toString() code:

return name.toLowerCase();

Filtering is working (the correct number of elements is returned), but it’s the wrong elements. It always shows the the first elements on the list instead of the ones that match the search…

  • 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-06-14T17:36:14+00:00Added an answer on June 14, 2026 at 5:36 pm

    I had exactly the same issue and I would assume (like me) that you didn’t read the documentation when trying to implement this.

    I was passing in my array of objects to the ArrayAdapter and subsequently passing the array onto the super constructor.

    The mistake I made was: I stored a reference to the passed in array and used that array to draw the items in the getView() method:

     public SimpleAdapter( Context context, List< MyType > values )
     {
        super( context, R.layout.rowlayout, values );
        this.context = context;
        this.values = values;
     }
    
      @Override
      public View getView( int position, View convertView, ViewGroup parent )
      {
        // ...
        MyType myType = values.get( position );
        // ...
      }
    

    What I should have done is called getItem() on the ArrayAdapter class e.g.

      MyType myType = getItem( position );
    

    Which fixed it beautifully and in hindsight is pretty obvious.

    -(e)

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

Sidebar

Related Questions

I have extended the ViewPager class and implemented onPageChangeListener. I use this ViewPager in
I have a class named CropImageView which is extended from ImageView . but the
I have extended the android View class, and now I want to define a
I have extended PHP's mysqli class, which works fine. But how can I make
I have extended Ext.data.Operation to implement a custom commitRecords method. The Ext.data.Operation class is
I have extended my class with a dialog in which I have set content
I have extended org.eclipse.ui.editors.text.TextEditor to implement a custom editor. For this editor, I have
I have extended threading.Thread - my idea is to do something like this: class
I have extended the Application class like this: public class MyApplication extends Application {
I have extended LinearLayout (vertical) to create a custom compound component. This in turn

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.