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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:43:49+00:00 2026-05-19T22:43:49+00:00

I have a search field that I want to autocomplete with data that I

  • 0

I have a search field that I want to autocomplete with data that I collect from two different places: a local database (sqlite), and a remote search API. I’d like to show the local options immediately, and then after a pause (so that I’m not making API requests on every keypress), start the API request.

The problem comes when the API request returns. How do I add those entries to the (already visible) dropdown for the AutoCompleteTextArea? Right now, I have a class that extends BaseAdapter:

private class MyAutoCompleteAdapter extends BaseAdapter implements Filterable {
    private List<String> resultList;
    private MySearchFilter filter;

    public BeerAutoCompleteAdapter() {
        super();
        results = new ArrayList<String>();
        filter = new MySearchFilter();
    }

    // getView, getCount, getItem overridden

    private void add(String newResult) {
        results.add(newResult);
        notifyDataSetChanged();
    }

    private class MySearchFilter extends Filter {
        // performFiltering and publishResults overridden
    }
}

Everything works 90%. When I call add(newResult), the new result gets added to the bottom of the dropdown. Unfortunately, the height of the dropdown doesn’t change. If there were two results before the API request, and one comes back from the API, all that happens is that I get a scrollbar on the dropdown. As soon as I scroll, the UI decides “oh, yeah, there’s room for that one too” and shows it.

I’ve tried forceLayout() and requestLayout() on my AutoCompleteTextArea, as well as notifyDataSetInvalidated(). No dice.

  • 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-19T22:43:50+00:00Added an answer on May 19, 2026 at 10:43 pm

    I figured it out. I was looking through the AutoCompleteTextArea source code and I noticed that showDropDown() had the logic for calculating height and width, and that it does that even if the dropdown is already visible. I tried it (in addition to notifyDataSetChanged()) and it worked.

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

Sidebar

Related Questions

So I have a location search field that I want to accept pretty much
I have a search form field that I want to compare with multiple columns
I have one table view that should be filtered by values of search field
I have an ASP.NET page that contains two div's. Both have search fields and
i have a form that have a field which hold query for search and
I would like to have one input field, where user will input search data.
I have a search box on my site that uses autocomplete to give suggestions,
I have a search field that uses a Drop down list to Filter search
If I have a GET search field, how could I have that submit to
I have created a simple search field that will ajax in relevant search results

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.