The documentation https://developer.android.com/reference/android/speech/tts/TextToSpeech.html has a method setVoice() where we can set a voice object.
But when I create a TextToSpeech object in my application, I dont get the method setVoice() .
TextToSpeech tts = tts = new TextToSpeech(this, this);
int result = tts.setLanguage(Locale.US); // I get this method
int result1 = tts.setVoice(); // I dont get this method.
setLanguage was added in API level 4 but setVoice was added in API level 21. Make sure you are using API level 21 or above to use setVoice.