Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. private void speach_text() {
  2.  
  3. if (textview2.toString().equals("1")) {
  4. loc1 = "en";
  5. loc2 = "en_EN";
  6. }
  7.  
  8. if (textview2.toString().equals("2")) {
  9. loc1 = "hi";
  10. loc2 = "hi_IN";
  11. }
  12. if (textview2.toString().equals("3")) {
  13. lo1 = "ar";
  14. lo2 = "ar_EG";
  15. }
  16.  
  17. final Locale locale = new Locale(lo1, lo2);
  18.  
  19. tts = new TextToSpeech(Mainactivity.this, new TextToSpeech.OnInitListener() {
  20.  
  21. @Override
  22. public void onInit(int status) {
  23. if (status == TextToSpeech.SUCCESS) {
  24. int result = tts.setLanguage(locale);
  25. tts.speak(textview1.getText().toString(),TextToSpeech.QUEUE_FLUSH, null);
  26. } else {
  27. }
  28. }
  29. });
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement