Android 如何在应用程序中创建语音活动?

Android 如何在应用程序中创建语音活动?,android,gridview,voice,Android,Gridview,Voice,我正在为孩子们创建一个新的应用程序。这个应用程序是为孩子们学习字母 现在我已经创建了一个主屏幕,其中使用GridView显示字母表。现在我想要的是,当点击特定的字母表时,它应该进入下一个屏幕,在该屏幕中,它应该用线条画出一个字母表,然后应该添加一个类似('a'代表苹果)的声音 有人知道怎么做吗?那么请帮帮我 提前感谢…试试这个: TextToSpeech mTextToSpeech = new TextToSpeech(this,new TextToSpeech.OnInitListener()

我正在为孩子们创建一个新的应用程序。这个应用程序是为孩子们学习字母

现在我已经创建了一个主屏幕,其中使用GridView显示字母表。现在我想要的是,当点击特定的字母表时,它应该进入下一个屏幕,在该屏幕中,它应该用线条画出一个字母表,然后应该添加一个类似('a'代表苹果)的声音

有人知道怎么做吗?那么请帮帮我

提前感谢…

试试这个:

TextToSpeech mTextToSpeech = new TextToSpeech(this,new TextToSpeech.OnInitListener()
{
  @Override
  public void onInit(int status)
  {
    // TODO Auto-generated method stub
    if(status == TextToSpeech.SUCCESS)
    {
      // set language
      int supported = mTextToSpeech.setLanguage(Locale.US);
      if((supported != TextToSpeech.LANG_AVAILABLE)&&(supported != TextToSpeech.LANG_COUNTRY_AVAILABLE))
      {
        displayToast("dont support current language");
      }
    }
  } 
});

// start to speak
mTextToSpeech.speak("A for Apple", TextToSpeech.QUEUE_FLUSH, null);  

// store your voice to file
int r = mTextToSpeech.synthesizeToFile(mEditText.getText().toString(), null, "/mnt/sdcard/speak.wav");
if(r == TextToSpeech.SUCCESS) displayToast("save success!");    
试试这个:

TextToSpeech mTextToSpeech = new TextToSpeech(this,new TextToSpeech.OnInitListener()
{
  @Override
  public void onInit(int status)
  {
    // TODO Auto-generated method stub
    if(status == TextToSpeech.SUCCESS)
    {
      // set language
      int supported = mTextToSpeech.setLanguage(Locale.US);
      if((supported != TextToSpeech.LANG_AVAILABLE)&&(supported != TextToSpeech.LANG_COUNTRY_AVAILABLE))
      {
        displayToast("dont support current language");
      }
    }
  } 
});

// start to speak
mTextToSpeech.speak("A for Apple", TextToSpeech.QUEUE_FLUSH, null);  

// store your voice to file
int r = mTextToSpeech.synthesizeToFile(mEditText.getText().toString(), null, "/mnt/sdcard/speak.wav");
if(r == TextToSpeech.SUCCESS) displayToast("save success!");