Posts

Showing posts with the label registerForActivityResult

Get Result From Other Activity - Android Studio - Compose

Image
How To Get Result From Another Activity Using the registerForActivityResult? In this tutorial, we will learn how to retrieve results from another activity using registerForActivityResult. You may be aware of using the method startActivityForResult, which is now deprecated. So we will use the newer way, which 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 back as a result to the MainActivity. >> Check For Java >> Check For Kotlin >> Check For Compose Code: MainActivity.kt package com.technifysoft.myapplication import android.app.Activity import android.content.Intent import android.os.Bundle import android.widget.Toast import androidx.activity.ComponentActivity import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.setContent import androidx.activity.result.contr...

Get Result From Other Activity - Android Studio - Kotlin

Image
How To Get Result From Another Activity Using the registerForActivityResult? In this tutorial, we will learn how to retrieve results from another activity using registerForActivityResult. You may be aware of using the method startActivityForResult, which is now deprecated. So we will use the newer way, which 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 back as a result to the MainActivity. >> Check For Java >> Check For Kotlin >> Check For Compose 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_heig...

Get Result From Other Activity - Android Studio - Java

Image
How To Get Result From Another Activity Using the registerForActivityResult? In this tutorial, we will learn how to retrieve results from another activity using registerForActivityResult. You may be aware of using the method startActivityForResult, which is now deprecated. So we will use the newer way, which 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 back as a result to the MainActivity. >> Check For Java >> Check For Kotlin >> Check For Compose 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_heig...