0

我想在我的比赛获胜后播放一点振动叮当声,有人有链接或知道我该怎么做吗?这是一首非常短的歌曲,所以代码越简单越好!多谢你们。

4

2 回答 2

1

这是您可以尝试的代码片段

package ravi.vibrationClass;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;


public class Vibrate extends MIDlet implements CommandListener{
    Form form;
    Display disp;
    Command vib,exit;
    public void startApp() {
        form = new Form("Vibration");
        disp = Display.getDisplay(this);
        exit = new Command("Exit", Command.EXIT, 1);
        vib = new Command("Vibrate", Command.OK, 1);
        form.append("Press \"vibrate\" to make the phone vibrate");
        form.addCommand(vib);
        form.addCommand(exit);
        form.setCommandListener(this);
        disp.setCurrent(form);

    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
        notifyDestroyed();
    }

    public void commandAction(Command c, Displayable arg1) {
        if(c == vib){
        disp.vibrate(125);
        }else if(c == exit){
        destroyApp(true);
        }

    }
}
于 2012-06-08T09:43:21.963 回答
0

检查以下链接:

于 2012-04-29T19:57:02.030 回答