2017-05-07 4 views
0

텍스트 음성 변환을 구현하려고했지만 메서드를 작성했을 때 음성 메서드가 올바르게 표시되지 않았습니다.텍스트 음성 변환 : 음성 메서드가 작동하지 않습니다.

MainActivity.java 내 메소드의 코드는 다음

private void ConvertTextToSpeech() { 
     // TODO Auto-generated method stub 
     text = et.getText().toString(); 
     // If no text is typed, tts will read out 'You haven't typed text' 
     // else it reads out the text you typed 
     if (text.length() == 0) { 
      tts.speak("You haven't typed text", TextToSpeech.QUEUE_FLUSH, null); 
     } else { 
      tts.speak(text, TextToSpeech.QUEUE_FLUSH, null); 

     } 

    } 

대신 위와 같이 나타나는, 그것은이

tts.s̶p̶e̶a̶k̶

내 build.gradle (응용 프로그램)처럼 보여주는 것은

입니다
apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.3" 
    defaultConfig { 
     applicationId "com.example.Hacker.texttospeech" 
     minSdkVersion 16 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
} 

어떻게 작동합니까? API 문제라고 생각합니다.
API 레벨 16에서이를 구현하려고합니다.

API 문제인 경우 API 레벨 16 이상에서 실행하는 방법은 무엇입니까?

+0

그 방법은 사용되지 않습니까? –

+0

예, 그게 무슨 뜻입니까. – Lakshmi

답변

0

다만이 방법은 speak(CharSequence, int, Bundle, String)

에 의해 그리고 그 ISN 경우, API 레벨 API 레벨 21으로 21

에서 사용되지 않는 대체 올바른 양식

에 대한 설명서를 확인 문제가 다른 곳에 있습니다.