【问题标题】:Trying to sen the progressValue of seekBar to server using OSC/UDP尝试使用 OSC/UDP 将 seekBar 的 progressValue 发送到服务器
【发布时间】:2017-04-25 02:38:08
【问题描述】:

所以,我正在尝试使用 OSC 将 seekBar 的 progressValue 发送到服务器。但是,我在服务器端没有收到任何信息。

连接有效,因为我有所有注册的单选按钮,以及一个也有效的玩家注册。任何人都可以检查此代码 sn-p 并提供一些建议吗?

 public void onProgressChanged(SeekBar seekbar, int progressValue,   boolean fromUser) {
      int step = 10;
        //  text = (TextView) findViewById(R.id.text);
        if(seekbar == Size) {
            progressValue = ((int) Math.round(progressValue / step)) * step;

            sz = progressValue;
            Size.setProgress(progressValue);
            text.setText(String.valueOf(progressValue));

            try{
            //This is where the value is being sent to the server    
            sender.send(new OSCMessage("/update_size", sz));
            }catch(Exception E){
                text.setText("Catch 3: "
                        + E.getClass().getName() + ", "
                        + E.getMessage());
            }
        }

【问题讨论】:

  • sz 是什么数据类型?和服务端注册的回调一样吗?如果它与预期的不匹配,它可能会在服务器上被静默丢弃。

标签: java android osc


【解决方案1】:

我必须使用一个数组方法在消息中传递浮点数或整数。我通过将它作为文本值传递,然后在服务器上解析它来解决这个问题。

【讨论】:

    猜你喜欢
    • 2017-08-21
    • 2014-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-31
    • 2018-09-03
    相关资源
    最近更新 更多