Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void speach_text() {
- if (textview2.toString().equals("1")) {
- loc1 = "en";
- loc2 = "en_EN";
- }
- if (textview2.toString().equals("2")) {
- loc1 = "hi";
- loc2 = "hi_IN";
- }
- if (textview2.toString().equals("3")) {
- lo1 = "ar";
- lo2 = "ar_EG";
- }
- final Locale locale = new Locale(lo1, lo2);
- tts = new TextToSpeech(Mainactivity.this, new TextToSpeech.OnInitListener() {
- @Override
- public void onInit(int status) {
- if (status == TextToSpeech.SUCCESS) {
- int result = tts.setLanguage(locale);
- tts.speak(textview1.getText().toString(),TextToSpeech.QUEUE_FLUSH, null);
- } else {
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement