aspose file tools*
The moose likes Android and the fly likes How to search contacts using serchable obtained from getSearchablesInGlobalSearch() in android Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to search contacts using serchable obtained from getSearchablesInGlobalSearch() in android" Watch "How to search contacts using serchable obtained from getSearchablesInGlobalSearch() in android" New topic
Author

How to search contacts using serchable obtained from getSearchablesInGlobalSearch() in android

Mustafa Dasorwala
Greenhorn

Joined: Sep 01, 2011
Posts: 29
I can use the following code to search for applications if i use (inf.getSuggestAuthority().startsWith("applications"))but i am not able to search contacts using inf.getSuggestAuthority().startsWith("com.android.contacts"). Need help.
I am trying to create a general search tool for android.




res/menu/searchview_in_menu.xml

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Searching contacts should be done via the ContactProvider. Here are some links on how:
Contacts Provider API Guide
Contacts Training

Steve
Mustafa Dasorwala
Greenhorn

Joined: Sep 01, 2011
Posts: 29
Steve Luke wrote:Searching contacts should be done via the ContactProvider. Here are some links on how:
Contacts Provider API Guide
Contacts Training


Thanks You for the reply Steve. What I am trying to create is a general search tool for android, can you gimme some pointers about what will be the best way to implement it.


Thanks & Regards
Mustafa I. Dasorwala
Mustafa Dasorwala
Greenhorn

Joined: Sep 01, 2011
Posts: 29
Steve Luke wrote:Searching contacts should be done via the ContactProvider. Here are some links on how:
Contacts Provider API Guide
Contacts Training


Also i would appreciate if you could tell me why the current code fails when I use "com.android.contacts" cause just like applications, contacts too are present in the searchables list.

Thanks.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Not, sure, can't say I have tried global searches - I just do contact specific searches. So I went to the SearchManager API and read it, and it says you will rarely ever need to interact with it, and that you should prefer using ACTION_SEARCH intents. This fires an intent that pings all apps and contexts that are searchable, so perhaps you should try to use that first.

Also, you still need permissions to get at contact data - did you request the proper permissions in your manifest?
Mustafa Dasorwala
Greenhorn

Joined: Sep 01, 2011
Posts: 29
Steve Luke wrote:Not, sure, can't say I have tried global searches - I just do contact specific searches. So I went to the SearchManager API and read it, and it says you will rarely ever need to interact with it, and that you should prefer using ACTION_SEARCH intents. This fires an intent that pings all apps and contexts that are searchable, so perhaps you should try to use that first.

Also, you still need permissions to get at contact data - did you request the proper permissions in your manifest?


Ya I did , both read and write permissions. I guess I'll use a different approach to solve the search problem.
Thanks Steve.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to search contacts using serchable obtained from getSearchablesInGlobalSearch() in android