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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:23:44+00:00 2026-05-26T17:23:44+00:00

I have a working custom search suggestions class (via http://developer.android.com/guide/topics/search/adding-custom-suggestions.html ). It currently returns

  • 0

I have a working custom search suggestions class (via http://developer.android.com/guide/topics/search/adding-custom-suggestions.html). It currently returns one type of information – “product names”.

I’ve added some additional activities (screens) to my app so that if a person is on a product page, starting up a search should return results from “product names”, but if they are in another activity, I would like the search suggestions to pull “manufacturer names”.

I saw Accessing appSearchData bundle from ContentProvider, but the custom search suggestions provider extends ContentProvider which doesn’t work with the answer

Bundle b = intent.getBundleExtra(SearchManager.APP_DATA);

This Bundle is available to the search results class, but not the contentprovider.

How best to pass a parameter (“product” or “manufacturer”) to a search suggestions content provider?

  • 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-26T17:23:45+00:00Added an answer on May 26, 2026 at 5:23 pm

    This doesn’t seem like an ideal solution, but I had the same need and I found I could get the job done by adding a public ivar or method to the subclass of ContentProvider that handles the search suggestions. Prior to initiating the search, you can configure your provider as needed. You can access the provider instance from an activity like so:

    ContentProviderClient client = getContentResolver().acquireContentProviderClient("my.searchsuggestionprovider");
    MyProviderClass provider = (MyProviderClass) client.getLocalContentProvider();
    

    Now you can configure with provider.setParameter("product") or whatever you need. You might need to reset the parameter to a default or something after building your cursor.

    Edit: This turned out to be impractical, at least in my case, since the content provider is called with query() every time a character is typed. Instead, I have employed a workaround similar to what is described in set-search-hint-dynamically. By creating an alternate “searchable” XML definition and activity, you can alter the URI that’s passed to the content provider in query(), adding a path component to provide the additional parameter or context you need.

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

Sidebar

Related Questions

I have a working custom UserNamePasswordValidator that calls into my Oracle DB. This class
I have wrote a custom MultipleChoiceField. I have everything working ok but when I
I am working on a custom avatar system for a project, but I have
I have this custom textbox that I am working on and I can use
I'm working on a web application that will have a custom UI for the
I have a custom ASPX search page for a CRM 4.0 solution I am
We have started working on samsung bada platform for our existing android apps and
I have developed a custom search engine for our Magento store and I am
I have made one custom user control (search text box), which basically consists of
I am working on an imap email client. I have a search function, which

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.