0

运行程序时,音乐仍在运行,但控制台不打印消息。问题出在哪里?

我不会很好地使用英语。对不起。

public class MultimediaSound extends MIDlet {
      public void startApp(){
          try {
          Player player = Manager.createPlayer(getClass().
          getResourceAsStream("/tuner1.wav"),"audio/x-wav");

          player.start();
          player.addPlayerListener(new PlayerListener(){

            public void playerUpdate(Player arg0, String arg1, Object arg2) {
                if(arg1 == (PlayerListener.STARTED)){
                    System.out.print(arg2.toString()+" " + "dkm ");
                }else{
                    System.out.print("dkm                  ");
                }
            }

          });
          } catch(Exception e) {
          e.printStackTrace();
          }
          }

          public void pauseApp() {}

          public void destroyApp(boolean unconditional) {}
}
4

1 回答 1

2

arg1 是您应该使用的字符串

if(arg1.equals(PlayerListener.STARTED))
于 2012-10-17T14:18:02.140 回答