我怎么能用黑莓振动功能做一个短调?

时间:2012-04-29 18:59:40

标签: blackberry vibrate

我希望在赢得比赛后有一点振动叮当声,是否有人有链接或知道我该怎么做?它是一首非常短的歌曲,因此代码越简单越好!谢谢你们。

2 个答案:

答案 0 :(得分: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);
        }

    }
}

答案 1 :(得分:0)