SearchSupportFragment

This package is part of the
Android support library which
is no longer maintained.
The support library has been superseded by AndroidX
which is part of Jetpack.
We recommend using the AndroidX libraries in all new projects. You should also consider
migrating existing projects to AndroidX.

A SpeechRecognizer object will be created for which your application will need to declare
android.permission.RECORD_AUDIO in AndroidManifest file. If app's target version is >= 23 and
the device version is >= 23, a permission dialog will show first time using speech recognition.
0 will be used as requestCode in requestPermissions() call.
setSpeechRecognitionCallback(SpeechRecognitionCallback) is deprecated.

Speech recognition is automatically started when fragment is created, but
not when fragment is restored from an instance state. Activity may manually
call startRecognition(), typically in onNewIntent().

Note that this can be called while the fragment's activity is
still in the process of being created. As such, you can not rely
on things like the activity's content view hierarchy being initialized
at this point. If you want to do work once the activity itself is
created, see onActivityCreated(Bundle).

Any restored child fragments will be created before the base
Fragment.onCreate method returns.

Parameters

savedInstanceState

Bundle: If the fragment is being re-created from
a previous saved state, this is the state.

onCreateView

Called to have the fragment instantiate its user interface view.
This is optional, and non-graphical fragments can return null (which
is the default implementation). This will be called between
onCreate(Bundle) and onActivityCreated(Bundle).

If you return a View from here, you will later be called in
onDestroyView() when the view is being released.

Parameters

inflater

LayoutInflater: The LayoutInflater object that can be used to inflate
any views in the fragment,

container

ViewGroup: If non-null, this is the parent view that the fragment's
UI should be attached to. The fragment should not add the view itself,
but this can be used to generate the LayoutParams of the view.

savedInstanceState

Bundle: If non-null, this fragment is being re-constructed
from a previous saved state as given here.

Note: It is possible that the permissions request interaction
with the user is interrupted. In this case you will receive empty permissions
and results arrays which should be treated as a cancellation.

startRecognition

Starts speech recognition. Typical use case is that
activity receives onNewIntent() call when user clicks a MIC button.
Note that SearchSupportFragment automatically starts speech recognition
at first time created, there is no need to call startRecognition()
when fragment is created.