0
$\begingroup$

Rosanswers logo

Hi,

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.


Originally posted by eminemm on ROS Answers with karma: 16 on 2018-09-18

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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 RosActivity.java 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.


Originally posted by eminemm with karma: 16 on 2018-09-18

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.