Posts

Showing posts from September, 2022

Get result from another activity using registerForActivityResult | Android Studio | Kotlin

Image
How To Get Result From Another Activity Using the registerForActivityResult? In this tutorial we will learn how to get result from another activity using registerForActivityResult. You might aware to use the method startActivityForResult which is now deprecated. So we will use the newer way that is registerForActivityResult. We will create 2 Activities the MainActivity and the FormActivity. From the MainActivity we will launch the FormActivity to input some data and get that data as result back to the MainActivity. >>Check For Java<< Code: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:gravity= "center...

Get result from another activity using registerForActivityResult | Android Studio | Java

Image
How To Get Result From Another Activity Using the registerForActivityResult? In this tutorial we will learn how to get result from another activity using registerForActivityResult. You might aware to use the method startActivityForResult which is now deprecated. So we will use the newer way that is registerForActivityResult. We will create 2 Activities the MainActivity and the FormActivity. From the MainActivity we will launch the FormActivity to input some data and get that data as result back to the MainActivity. >>Check For Kotlin<< Code: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:gravity= "cent...