Esempio n. 1
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_hello_tts);
   getSupportActionBar().setDisplayHomeAsUpEnabled(true);
   tMsg = (TextView) findViewById(R.id.tMsg);
   tts = new TextToSpeech(this, this);
 }
Esempio n. 2
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (requestCode == ACTION_CHECK_DATA_CODE) {
     if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
       toast("Pacote de dados de voz OK!");
     } else {
       // Falta pacote, solicita instalação
       Intent installIntent = new Intent();
       installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
       startActivity(installIntent);
     }
   }
 }
Esempio n. 3
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   // Libera os recursos da engine do TTS
   tts.shutdown();
 }