title: Get Android activity result in Flutter
body: <p>I have a thirdparty Android control that can't be used in Flutter directly. I put it in an Android activity. Then, using information from <a href="https://flutter.io/docs/development/platform-integration/platform-channels#step-3b-add-an-android-platform-specific-implementation-using-kotlin" rel="noreferrer">https://flutter.io/docs/development/platform-integration/platform-channels#step-3b-add-an-android-platform-specific-implementation-using-kotlin</a>, I can successfully launch that activity and perform some actions there. The only part that doesn't work is sending results back from the activity.</p>
  
  <p>Flutter code:</p>
  
  <pre><code>void showDialog() async
      {
          try {
              final Map&lt;String, List&lt;double&gt;&gt; result = await platform.invokeMethod('show_dialog',
                  &lt;String, String&gt;{
                      'address': widget.user.address
                  });
              widget.user.address = result.keys.toList()[0];
          } on PlatformException catch (e) {
              print('Failed to pick address: ${e.message}.');
          }
      }
  </code></pre>
  
  <p>Android code:</p>
  
  <pre><code>class MainActivity: FlutterActivity() {
    private val CHANNEL = "dialog"
    private lateinit var _result: MethodChannel.Result
    override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      GeneratedPluginRegistrant.registerWith(this)
      MethodChannel(flutterView, CHANNEL).setMethodCallHandler { call, result -&gt;
        if (call.method == "show_dialog") {
            _result = result
            val intent = Intent(this@MainActivity, DialogActivity::class.java)
            intent.putExtra("address", call.argument&lt;String&gt;("address"))
            startActivityForResult(intent, 9689)
        }
        else result.notImplemented()
      }
    }
    override fun onActivityResult(requestCode: Int, result: Int, intent: Intent?) {
        if(requestCode != 9689)
            return super.onActivityResult(requestCode, result, intent)
        if (result == Activity.RESULT_OK) {
            _result.success(mapOf(intent!!.getStringExtra("address") to
                listOf(intent.getDoubleExtra("latitude", 0.0),
                    intent.getDoubleExtra("longitude", 0.0))))
        }
        else
            _result.success(null)
    }
  }
  </code></pre>
  
  <p>What's the problem? Breakpoint on the line <code>widget.user.address = result.keys.toList()[0];</code> is never reached, suggesting the result is never sent back.</p>