# Interface RecognitionCallback

All Known Subinterfaces:
  `TimedRecognitionCallback`

All Known Implementing Classes:
  `RecognitionCallback.Adapter, TimedRecognitionCallback.Adapter`

public interface RecognitionCallback
Listener for `SpeechRecognizer` results. Every method is invoked on the EDT.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static class`
  `RecognitionCallback.Adapter`
  No-op adapter.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onEnd()`
  Recognition session ended (timeout, mic released, or `SpeechRecognizer.stop()`).
  `void`
  `onError(Throwable t)`
  Recognition failed (no permission, no network for online engines, hardware error).
  `void`
  `onPartialResult(String transcript)`
  Best-effort transcript while the user is still speaking.
  `void`
  `onResult(String transcript, float confidence, String[] alternatives)`
  Final transcript for a single utterance.

- ## Method Details

  - ### onPartialResult

    void onPartialResult(String transcript)
    Best-effort transcript while the user is still speaking. May fire many times before `onResult(String, float, String[])`. Skip overriding if `RecognitionOptions.setPartialResults(false)` was passed.

  - ### onResult

    void onResult(String transcript, float confidence, String[] alternatives)
    Final transcript for a single utterance. `confidence` is in `[0.0, 1.0]` when the platform supplies one, or `-1` when it doesn't. `alternatives` may be empty.

  - ### onEnd

    void onEnd()
    Recognition session ended (timeout, mic released, or `SpeechRecognizer.stop()`). No more callbacks will fire.

  - ### onError

    void onError(Throwable t)
    Recognition failed (no permission, no network for online engines, hardware error).