ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

rosandroid tutorial_pubsub connection bewteen RosTextView and Talker-message

asked 2014-08-06 09:18:57 -0500

stefan gravatar image

In the talker the message is published

in the res/layout a rostextview is created

where is the link that makes the rostextview show the message?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-06 10:05:12 -0500

gvdhoorn gravatar image

updated 2014-08-06 10:09:29 -0500

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

If you want the actual source, see in, 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>() {
    public void onNewMessage(final T message) {
      if (callable != null) {
        post(new Runnable() {
          public void run() {
      } else {
        post(new Runnable() {
          public void run() {

The 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.

edit flag offensive delete link more


ok... :) ... i guess i lost sight of the wood for the trees yesterday - should have looked in my onCreate in the MainActivity - i added a whole lot of stuff in between meanwhile

stefan gravatar image stefan  ( 2014-08-07 01:42:18 -0500 )edit

So, question answered then?

gvdhoorn gravatar image gvdhoorn  ( 2014-08-07 10:13:49 -0500 )edit

Question Tools

1 follower


Asked: 2014-08-06 09:18:57 -0500

Seen: 154 times

Last updated: Aug 06 '14