Ask Your Question

Revision history [back]

Could you indicate what wasn't clear in the extended answer to your previous question?

If you want the actual source, see RosTextView.java in org.ros.android.view, lines 68 to 92:

public void onStart(ConnectedNode connectedNode) {
  Subscriber<T> subscriber = connectedNode.newSubscriber(topicName, messageType);
  subscriber.addMessageListener(new MessageListener<T>() {
    @Override
    public void onNewMessage(final T message) {
      if (callable != null) {
        post(new Runnable() {
          @Override
          public void run() {
            setText(callable.call(message));
          }
        });
      } else {
        post(new Runnable() {
          @Override
          public void run() {
            setText(message.toString());
          }
        });
      }
      postInvalidate();
    }
  });
}

RosTextView::onNewMessage(..) essentially calls the callback registered earlier by the user, which in the case of a std_msgs::String could just return the string itself.

Could you indicate what wasn't clear in the extended answer to your previous question?

If you want the actual source, see RosTextView.java in org.ros.android.view, lines 68 to 92: (this is the Hydro version):

public void onStart(ConnectedNode connectedNode) {
  Subscriber<T> subscriber = connectedNode.newSubscriber(topicName, messageType);
  subscriber.addMessageListener(new MessageListener<T>() {
    @Override
    public void onNewMessage(final T message) {
      if (callable != null) {
        post(new Runnable() {
          @Override
          public void run() {
            setText(callable.call(message));
          }
        });
      } else {
        post(new Runnable() {
          @Override
          public void run() {
            setText(message.toString());
          }
        });
      }
      postInvalidate();
    }
  });
}

RosTextView::onNewMessage(..) essentially calls the callback registered earlier by the user, which in the case of a std_msgs::String could just return the string itself.

Could you indicate what wasn't clear in the extended answer to your previous question?

If you want the actual source, see RosTextView.java in org.ros.android.view, lines 68 to 92 (this is the Hydro version):

public void onStart(ConnectedNode connectedNode) {
  Subscriber<T> subscriber = connectedNode.newSubscriber(topicName, messageType);
  subscriber.addMessageListener(new MessageListener<T>() {
    @Override
    public void onNewMessage(final T message) {
      if (callable != null) {
        post(new Runnable() {
          @Override
          public void run() {
            setText(callable.call(message));
          }
        });
      } else {
        post(new Runnable() {
          @Override
          public void run() {
            setText(message.toString());
          }
        });
      }
      postInvalidate();
    }
  });
}

RosTextView::onNewMessage(..) essentially calls the callback registered earlier by the user, which in the case of a std_msgs::String could just return the string itself.


Btw: you might be interested in the ros-sig-java.

Could you indicate what wasn't clear in the extended answer to your previous question?

If you want the actual source, see RosTextView.java in org.ros.android.view, lines 68 to 92 (this is the Hydro version):

public void onStart(ConnectedNode connectedNode) {
  Subscriber<T> subscriber = connectedNode.newSubscriber(topicName, messageType);
  subscriber.addMessageListener(new MessageListener<T>() {
    @Override
    public void onNewMessage(final T message) {
      if (callable != null) {
        post(new Runnable() {
          @Override
          public void run() {
            setText(callable.call(message));
          }
        });
      } else {
        post(new Runnable() {
          @Override
          public void run() {
            setText(message.toString());
          }
        });
      }
      postInvalidate();
    }
  });
}

RosTextView::onNewMessage(..) essentially calls the callback registered earlier by the user, which in the case of a std_msgs::String could just return the string itself.


Btw: you might be interested in the ros-sig-javaROS Java Special Interest Group.

Could you indicate what wasn't clear in the extended answer to your previous question?

If you want the actual source, see RosTextView.java in org.ros.android.view, lines 68 to 92 (this is the Hydro version):

public void onStart(ConnectedNode connectedNode) {
  Subscriber<T> subscriber = connectedNode.newSubscriber(topicName, messageType);
  subscriber.addMessageListener(new MessageListener<T>() {
    @Override
    public void onNewMessage(final T message) {
      if (callable != null) {
        post(new Runnable() {
          @Override
          public void run() {
            setText(callable.call(message));
          }
        });
      } else {
        post(new Runnable() {
          @Override
          public void run() {
            setText(message.toString());
          }
        });
      }
      postInvalidate();
    }
  });
}

The RosTextView::onNewMessage(..)onNewMessage(..) method essentially calls the callback registered earlier by the user, which in the case of a std_msgs::String could just return the string itself.


Btw: you might be interested in the ROS Java Special Interest Group.