Book Image

Getting Started with UDOO

By : Maurizio Caporali, Emanuele Palazzetti
Book Image

Getting Started with UDOO

By: Maurizio Caporali, Emanuele Palazzetti

Overview of this book

Table of Contents (16 chapters)
Getting Started with UDOO
About the Author
About the Reviewers

Improving user interaction with voice synthesis

Even if the Chronotherm application is working correctly, we have at least one more thing to do: providing proper feedback to let users know the action that was taken. Indeed, both activities fail to provide any visual feedback about what the recognized input is; for this reason, we decided to introduce the voice synthesis API within the initial design.

Because we want to share the synthesis procedure across different activities, we could create a manager that abstracts the synthesis API with a common initialization. The idea is to provide a class that exposes the method to start voice recognition with the given string; we implement it in the following steps:

  1. Create the VoiceManager class inside the voice package.

  2. Initialize the class with the following code:

    public class VoiceManager implements TextToSpeech.OnInitListener {
      private TextToSpeech mTts;

    This class implements the OnInitListener interface that defines the callback that should...