7

Hi i would like to add google search api to my application.and the search result should be shown in a list view...can any one send me some example or tell me how to do it??

user2713202
  • 85
  • 1
  • 1
  • 6
  • Check this link it will help you. http://developer.android.com/guide/topics/search/index.html – arshu Oct 21 '13 at 12:33

2 Answers2

6

Here it is:

import android.app.SearchManager;

// ...

Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);  
intent.putExtra(SearchManager.QUERY, "Search query");    
startActivity(intent);

Voice-based search:

import android.speech.RecognizerIntent;

// ...

Intent sp = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
sp.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
sp.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak please");
startActivity(sp);
Edric
  • 24,639
  • 13
  • 81
  • 91
Nizam
  • 5,698
  • 9
  • 45
  • 57
  • 1
    can u please sent ur total code – kumar Apr 22 '14 at 07:18
  • 1
    I remember that it's possible to provide search results for the Google-Search app, and that this was announced a very long time ago. Do you know perhaps where to find such a thing in the docs? – android developer Jun 09 '15 at 16:10
2

Here is a good example on implementing google search in your android application Implementing google search .Hope it helps.

Community
  • 1
  • 1
Illegal Argument
  • 10,090
  • 2
  • 44
  • 61