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

Android onActivityResult shutdown (kinetic)

asked 2018-09-18 01:30:48 -0500

eminemm gravatar image

updated 2018-09-18 03:32:28 -0500


How should I properly use onActivityResult in my MainActivity that extends RosActivity?

In my MainActivity, I call another activity using startactivityforresult, then in that activity I call

Intent resultIntent = new Intent(); resultIntent.putExtra(INSERTED_ORDER, orderET.getText().toString()); setResult(Activity.RESULT_OK, resultIntent); finish();

but after that the method shutdown() of RosActivity is getting called closing the application.

Without RosActivity my code works correctly and the only difference is that I added super.onActivityResult(requestCode,resultCode,data); otherwise init(NodeMainExecutor nodeMainExecutor) is not getting called after MasterChooser activity.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-09-18 03:28:12 -0500

eminemm gravatar image

updated 2018-09-18 03:28:55 -0500

I just found where the problem is. Basically when I call super.onActivityResult(requestCode,resultCode,data) inside onActivityResult(int requestCode, int resultCode, Intent data), in my RosActivity, it calls onActivityResult(requestCode,resultCode,data) of where if (requestCode != MASTER_CHOOSER_REQUEST_CODE) it calls nodeMainExecutorService.forceShutdown();

In my MainActivity, inside onActivityResult I call super.onActivityResult(requestCode,resultCode,data) only when requestCode is different from the one I created resolving the problem.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-09-18 01:30:48 -0500

Seen: 326 times

Last updated: Sep 18 '18