android.support.v17.leanback.widget.SpeechRecognitionCallback Java Examples
The following examples show how to use
android.support.v17.leanback.widget.SpeechRecognitionCallback.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchActivity.java From leanback-showcase with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.search); mFragment = (SearchFragment) getFragmentManager().findFragmentById(R.id.search_fragment); if (USE_INTERNAL_SPEECH_RECOGNIZER) { mSpeechRecognitionCallback = new SpeechRecognitionCallback() { @Override public void recognizeSpeech() { if (DEBUG) { Log.v(TAG, "recognizeSpeech"); } startActivityForResult(mFragment.getRecognizerIntent(), REQUEST_SPEECH); } }; mFragment.setSpeechRecognitionCallback(mSpeechRecognitionCallback); } }
Example #2
Source File: SearchActivity.java From VCL-Android with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tv_search); mFragment = (SearchFragment) getFragmentManager() .findFragmentById(R.id.search_fragment); SpeechRecognitionCallback speechRecognitionCallback = new SpeechRecognitionCallback() { @Override public void recognizeSpeech() { startActivityForResult(mFragment.getRecognizerIntent(), REQUEST_SPEECH); } }; mFragment.setSpeechRecognitionCallback(speechRecognitionCallback); }
Example #3
Source File: SearchFragment.java From BuildingForAndroidTV with MIT License | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter()); setSearchResultProvider(this); setOnItemViewClickedListener(new ItemViewClickedListener()); if (!hasPermission(Manifest.permission.RECORD_AUDIO)) { // SpeechRecognitionCallback is not required and if not provided recognition will be handled // using internal speech recognizer, in which case you must have RECORD_AUDIO permission setSpeechRecognitionCallback(new SpeechRecognitionCallback() { @Override public void recognizeSpeech() { if (DEBUG) Log.v(TAG, "recognizeSpeech"); try { startActivityForResult(getRecognizerIntent(), REQUEST_SPEECH); } catch (ActivityNotFoundException e) { Log.e(TAG, "Cannot find activity for speech recognizer", e); } } }); } }
Example #4
Source File: SearchSupportFragment.java From adt-leanback-support with Apache License 2.0 | 5 votes |
/** * Set this callback to have the fragment pass speech recognition requests * to the activity rather than using an internal recognizer. */ public void setSpeechRecognitionCallback(SpeechRecognitionCallback callback) { mSpeechRecognitionCallback = callback; if (mSearchBar != null) { mSearchBar.setSpeechRecognitionCallback(mSpeechRecognitionCallback); } if (callback != null) { releaseRecognizer(); } }
Example #5
Source File: SearchFragment.java From adt-leanback-support with Apache License 2.0 | 5 votes |
/** * Set this callback to have the fragment pass speech recognition requests * to the activity rather than using an internal recognizer. */ public void setSpeechRecognitionCallback(SpeechRecognitionCallback callback) { mSpeechRecognitionCallback = callback; if (mSearchBar != null) { mSearchBar.setSpeechRecognitionCallback(mSpeechRecognitionCallback); } if (callback != null) { releaseRecognizer(); } }