Posts

Showing posts with the label rememberLauncherForActivityresult

startActivityForResult Depreciated Solution - Android Studio - Compose

Image
How to use ActivityResult | ActivityResultLauncher |  rememberLauncherForActivityResult ? Since the  startActivityForResult()  used to launce the intents like  Gallery ,  Camera ,  File Pick ,  Share data , etc is deprecated so now there is a new way to do that  ActivityResultLauncher  class. In the Jetpack Compose we use  rememberLauncherForActivityResult instead of  ActivityResultLauncher . >> Check for Java >> Check for Kotlin >> Check for Compose Code: build.gradle Add the following library to the dependencies section of your app-level build.gradle file. This will be used to set the image picked from the Gallery to the Image . implementation("io.coil-kt:coil-compose:2.6.0") MainActivity.kt package com.technifysoft.myapplication import android.app.Activity import android.net.Uri import android.os.Bundle import android.widget.Toast import androidx.activity.ComponentActivity import androidx.acti...