audio - 在Blackberry的单个应用程序中禁用声音

标签 audio blackberry text-to-speech

我只是在黑莓手机上做了一个字典应用程序,并有语音到文本转换的支持。一切正常。现在我想在用户需要时禁用声音,所以我如何以编程方式进行操作。请帮助我

最佳答案

试试这个

use the flag value as reference


if flag value is true then user click on item then it will play the sound
else sound wont play and display one dialog that Do you want enable sound with two options yes or no 
            if user click on yes then make flag value as true and item.setText("Voice Disable"); otherwise no action means no changes in flag
             in your list item click listener write condition as following
            if(flag==true)
            {
                write your logic to play
            }

示例代码是
public class app extends UiApplication{


    public static void main(String[] args) {
        new app().enterEventDispatcher();
    }

    public app() {
        pushScreen(new SampleScreen()); 
    }
}
class SampleScreen extends MainScreen
{
    static boolean flag=true;
    MenuItem item=null;
    public SampleScreen() {

//      use the flag value as reference
//      if flag value is true then user click on item then it will play the sound
//      else sound wont play and display one dialog that Do you want enable sound with two options yes or no 
//      if user click on yes then make flag value as true and item.setText("Voice Disable"); otherwise no action means no changes in flag
//       in your list item click listner write condition as following
//      if(flag==true)
//      {
//          write your logic to play
//      }



        // you already implement 

        item=new MenuItem("Voice Disable",0,100) {
            public void run() {
                if(flag)
                {
                    flag=false;
                    item.setText("Voice Enable");
                    UiApplication.getUiApplication().invokeLater(new Runnable() {
                        public void run() {
                            Dialog.inform("Voice Disable succesfully");
                        }
                    });
                }else{
                    flag=true;
                    item.setText("Voice Disable");
                    UiApplication.getUiApplication().invokeLater(new Runnable() {
                        public void run() {
                            Dialog.inform("Voice Enable succesfully");
                        }
                    });
                }

            }
        };
        addMenuItem(item);

    }
}

关于audio - 在Blackberry的单个应用程序中禁用声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9238654/

相关文章:

jquery - 移动网站无法在黑莓上加载

c# - ASP.NET 中的文本到语音 - 访问被拒绝......该怎么办?

speech-recognition - 文本转语音(语音生成)和语音转文本(语音识别)API?

android - TextToSpeech Android 的自定义语音

java - 为什么音频文件听起来不同?

vb.net - 创建每个样本值具有任意位的WAV文件?

audio - 分析声音

blackberry - PopUpScreen 中的问题

javascript - 用javascript的媒体流识别歌曲

iphone - iPhone/Android/Blackberry 应用商店如何处理应用评论