Created
April 17, 2019 02:02
-
-
Save truongsinh/295002e1f9c87b15f0105b8307635770 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git step/04app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt step/05app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt | |
index fbf9de8..c0e8651 100644 | |
--- step/04app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt | |
+++ step/05app/src/main/java/pro/truongsinh/flutter/android_flutter_host/MainActivity.kt | |
@@ -1,6 +1,8 @@ | |
package pro.truongsinh.flutter.android_flutter_host | |
+import android.content.Intent | |
import android.os.Bundle | |
+import android.util.Log | |
import androidx.appcompat.app.AppCompatActivity | |
import android.view.Menu | |
import android.view.MenuItem | |
@@ -27,8 +29,14 @@ class MainActivity : AppCompatActivity() { | |
.initialRoute("anotherRoute") | |
.build(this) | |
.putExtra("route_args", hashMapOf("arg1Key" to "arg1Value", "arg2Key" to 2)) | |
- startActivity(flutterEmbeddingActivityIntent) | |
+ startActivityForResult(flutterEmbeddingActivityIntent, 42) | |
+ } | |
} | |
+ | |
+ override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) { | |
+ super.onActivityResult(requestCode, resultCode, intent) | |
+ val data = intent?.extras?.keySet()?.associateBy({it}, {intent.extras.get(it)}) | |
+ Log.d("Flutter example", "requestCode: $requestCode, resultCode: $resultCode, data $data") | |
} | |
override fun onCreateOptionsMenu(menu: Menu): Boolean { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment