The use of startActivityForResult is a very common and useful practice to do things within your application.
But it suffers from a architecture issue, very rare and difficult to find out.
The onActivityResult method gets called immediately after the startActivityForResult. This happens because the started activity lacks the correct launchMode which must be set to “standard”.
You may also experience the “Activity is launching as a new task, so cancelling activity result.” from the ActivityManager which explains why is behaves like this.