Search suggestions from different tables in different activities Search suggestions from different tables in different activities sqlite sqlite

Search suggestions from different tables in different activities


You simply need to add another searchable file. You can name it whatever you like, so since tasks is missing why not use searchable_tasks.xml?

Now copy all of the existing searchable.xml into this file, change the searchSuggestPath to TasksTable and do the same for searchSuggestIntentData.

Of course you have to expand your content provider as well (add those additional possibilities to the URIMatcher and react to the respective URIs in the query method).


you should use the database join for all the table “BirthdayWisher_Table”, “Tasks_Table”, “Events_Table” and “BirthdayWisher_Activity”, “Tasks_Activity”, “Events_Activity” respectively to retrieve all table information. hope this Link could help you to understand what i am talking about. then you can parse all table information in search suggestion

another way to use AutoCompleteTextview

have a look on to this source code

SuggestionAdapter class put the parameter "type" in constructor.

   String type;   public SuggestionAdapter(Activity context, String nameFilter,String type) {            super(context, android.R.layout.simple_dropdown_item_1line);            suggestions = new ArrayList<String>();            this.type=type;    }

and then retrieve the information by typeon getFilter() method

List<SuggestGetSet> new_suggestions = db.getInformation(type)

then use the AutoCompleteTextView like following

  AutoCompleteTextView acTextView = (AutoCompleteTextView)findViewById(R.id.autoComplete);  acTextView.setAdapter(new SuggestionAdapter(this,acTextView.getText().toString(),"Tasks_Table"));


If i am not wrong you can achieve this by:

Pass the activity name with intent to search Activity.Get the called Activity Name from intent.Now you have the called activity name , You can do whatever you want.