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:
Create the
VoiceManager
class inside thevoice
package.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...