gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 23:59:41 24 4
gpt4 key购买 nike

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

最佳答案

试试这个

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com