List of usage examples for android.content Intent ACTION_WEB_SEARCH
String ACTION_WEB_SEARCH
To view the source code for android.content Intent ACTION_WEB_SEARCH.
Click Source Link
From source file:com.vyasware.vaani.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); returnedText = (TextView) findViewById(R.id.textView1); outputText = (TextView) findViewById(R.id.textView2); progressBar = (ProgressBar) findViewById(R.id.progressBar1); toggleButton = (ToggleButton) findViewById(R.id.toggleButton1); progressBar.setVisibility(View.INVISIBLE); speech = SpeechRecognizer.createSpeechRecognizer(this); speech.setRecognitionListener(this); recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); // recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, // "en"); recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, this.getPackageName()); recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "hi-IN"); recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "hi-IN"); recognizerIntent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, "hi-IN"); recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 5); tts = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() { @Override//www . ja v a 2 s . co m public void onInit(int status) { if (status != TextToSpeech.ERROR) { tts.setLanguage(new Locale("hi_IN")); tts.setSpeechRate(0.9f); } } }); returnedText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, returnedText.getText()); if (intent.resolveActivity(getPackageManager()) != null) startActivity(intent); } }); toggleButton.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { progressBar.setVisibility(View.VISIBLE); progressBar.setIndeterminate(true); speech.startListening(recognizerIntent); outputText.setText(""); } else { progressBar.setIndeterminate(false); progressBar.setVisibility(View.INVISIBLE); speech.stopListening(); } } }); }
From source file:com.free.underground.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle.onOptionsItemSelected(item)) { return true; }// w w w . j a va2 s. co m // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getActionBar().getTitle()); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:dev.dworks.libs.actionbartoggle.demo.SlidingPaneLayoutActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mActionBarToggle.onOptionsItemSelected(item)) { return true; }/* w ww .j a va2s . com*/ // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: // create intent to perform web search for this planet Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getSupportActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:pwr.itapps.meetme.activity.WallActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. Intent intent;//from w w w. j av a 2 s. c o m if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: // create intent to perform web search for this planet intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; case R.id.services_download: Fragment f = getActiveFragment(); if (f instanceof FriendsFragment) { ((FriendsFragment) f).downloadContacs(); } else if (f instanceof EventListFragment) { ((EventListFragment) f).runRefresh(); } return true; case R.id.action_createEvent: // create intent to perform web search for this planet intent = new Intent(getApplicationContext(), CreateEventActivity.class); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.github.blalasaadri.sprinttopics.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; }//from w ww .j av a 2 s.c o m // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: // create intent to perform web search for this planet Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getSupportActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.example.android.navigationdrawerexample.ContentDrawerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: // create intent to perform web search for this planet Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getSupportActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent);/*from w w w. j ava 2s . c om*/ } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.android.quicksearchbox.ShortcutRepositoryTest.java
@Override protected void setUp() throws Exception { super.setUp(); mConfig = new Config(getContext()); mCorpora = new MockCorpora(); mCorpora.addCorpus(APP_CORPUS);/*ww w. j a va 2 s . c o m*/ mCorpora.addCorpus(CONTACTS_CORPUS); mCorpora.addCorpus(WEB_CORPUS); mRefresher = new MockShortcutRefresher(); mLogExecutor = new MockExecutor(); mRepo = createShortcutRepository(); mAllowedCorpora = new ArrayList<Corpus>(mCorpora.getAllCorpora()); mApp1 = makeApp("app1"); mApp2 = makeApp("app2"); mApp3 = makeApp("app3"); mAppSuggestions = new ListSuggestionCursor("foo", mApp1, mApp2, mApp3); mContact1 = new SuggestionData(CONTACTS_SOURCE).setText1("Joe Blow").setIntentAction("view") .setIntentData("contacts/joeblow").setShortcutId("j-blow"); mContact2 = new SuggestionData(CONTACTS_SOURCE).setText1("Mike Johnston").setIntentAction("view") .setIntentData("contacts/mikeJ").setShortcutId("mo-jo"); mWeb1 = new SuggestionData(MockSource.WEB_SOURCE).setText1("foo").setIntentAction(Intent.ACTION_WEB_SEARCH) .setSuggestionQuery("foo"); mContactSuggestions = new ListSuggestionCursor("foo", mContact1, mContact2); }
From source file:com.example.android.navigationdrawerexample.LeftDrawerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mHorizonDrawerToggle.onOptionsItemSelected(item)) { return true; }/*from ww w . jav a 2 s. c o m*/ // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: // create intent to perform web search for this planet Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getSupportActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.example.android.navigationdrawerexample.BottomDrawerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mVerticalDrawerToggle.onOptionsItemSelected(item)) { return true; }//from www .j a v a 2 s. c o m // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: // create intent to perform web search for this planet Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getSupportActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.songnick.blogdemo.NetEaseDemo_Activity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // The action bar home/up action should open or close the drawer. // ActionBarDrawerToggle will take care of this. if (mDrawerToggle.onOptionsItemSelected(item)) { return true; }/* w ww .j av a 2s . c o m*/ // Handle action buttons switch (item.getItemId()) { case R.id.action_settings: // create intent to perform web search for this planet Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }