我在我的android应用程序中使用Text to speech.它与Google TTs和espeak工作正常,但是当我使用Samsung TTS时,它会给出以下异常.
java.lang.IllegalArgumentException: Invalid int: "OS"
at android.os.Parcel.readException(Parcel.java:1429)
at android.os.Parcel.readException(Parcel.java:1379)
at android.speech.tts.ITextToSpeechService$Stub$Proxy.isLanguageAvailable(ITextToSpeechService.java:482)
at android.speech.tts.TextToSpeech$10.run(TextToSpeech.java:1084)
at android.speech.tts.TextToSpeech$10.run(TextToSpeech.java:1081)
at android.speech.tts.TextToSpeech$Connection.runAction(TextToSpeech.java:1329)
at android.speech.tts.TextToSpeech.runAction(TextToSpeech.java:570)
at android.speech.tts.TextToSpeech.runAction(TextToSpeech.java:561)
at android.speech.tts.TextToSpeech.isLanguageAvailable(TextToSpeech.java:1081)
Run Code Online (Sandbox Code Playgroud) 我在我的Android应用程序中实现了tts.它支持Android设备中默认TTS支持的所有语言.但是有可能获得在默认TTS中选择的语言名称,即在设置中在Google TTS中选择的语言名称吗?
我想在我的Android应用程序中实现两个手指轻扫手势.我使用了以下代码:
void handleTouch(MotionEvent m){
//Number of touches
int pointerCount = m.getPointerCount();
if(pointerCount == 2){
int action = m.getActionMasked();
int actionIndex = m.getActionIndex();
String actionString;
TextView tv = (TextView) findViewById(R.id.testDiffText);
switch (action)
{
case MotionEvent.ACTION_DOWN:
GLOBAL_TOUCH_POSITION_X = (int) m.getX(1);
actionString = "DOWN"+" current "+GLOBAL_TOUCH_CURRENT_POSITION_X+" prev "+GLOBAL_TOUCH_POSITION_X;
tv.setText(actionString);
break;
case MotionEvent.ACTION_UP:
GLOBAL_TOUCH_CURRENT_POSITION_X = 0;
actionString = "UP"+" current "+GLOBAL_TOUCH_CURRENT_POSITION_X+" prev "+GLOBAL_TOUCH_POSITION_X;
tv.setText(actionString);
break;
case MotionEvent.ACTION_MOVE:
GLOBAL_TOUCH_CURRENT_POSITION_X = (int) m.getX(1);
int diff = GLOBAL_TOUCH_POSITION_X-GLOBAL_TOUCH_CURRENT_POSITION_X;
actionString = "Diff "+diff+" current "+GLOBAL_TOUCH_CURRENT_POSITION_X+" prev "+GLOBAL_TOUCH_POSITION_X;
tv.setText(actionString); …Run Code Online (Sandbox Code Playgroud)