Search Manaager

Put your problem here if it does not fit any of the other categories.

Search Manaager

Postby ayden » Tue Mar 10, 2009 12:14 pm

I'm trying to use search manager now.
and my partial code is as below:

Intent search = new Intent(Intent,ACTION_SEARCH);
search.putExtra(SearchManager.QUERY, query_string);
startActivity(search);

It would popup a dialog that lists all applicatons that have "ACTION_SEARCH" in AndroidMenifest.xml,
ex: Contacts, Google Search...
After choosing "Contacs", it would return the result of searching Contacts.

Is there a way that i can set the intent to search Contacts directly without the popup dialog?

thanks
ayden
Freshman
Freshman
 
Posts: 6
Joined: Fri Mar 06, 2009 10:56 am

Top

Postby ayden » Wed Mar 11, 2009 5:00 am

Reply question by myself :P

intent should use setComponent(package name, class name) to set which application you want to search.

code should look like this:

Intent search = new Intent(Intent,ACTION_SEARCH);
search.setComponent(new Component(package name, class name));
search.putExtra(SearchManager.QUERY, query_string);
startActivity(search);

Therefore, you can search the appication you want directly.
ayden
Freshman
Freshman
 
Posts: 6
Joined: Fri Mar 06, 2009 10:56 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 11 guests