Questions tagged [activity-result-api]

24 questions
16
votes
1 answer

How to get requestCode from Activity Result API

I am very new to Android Kotlin programming. I am making an app to create, read and delete file using Storage Access Framework. I did it by implementing deprecated startActivityForResult intent to perform file read, create, delete tasks. I tried to…
sujan_014
  • 516
  • 2
  • 8
  • 22
8
votes
4 answers

How to construct PickVisualMediaRequest for ActivityResultLauncher

I am trying to use the Activity Result APIs to handle the picking of a single photo for an app I am developing. I am trying to use one of the predefined contracts to keep things simple. So, I am attempting to use the…
7
votes
1 answer

How do I use registerForActivityResult with StartIntentSenderForResult contract?

I am writing a Kotlin app and using Firebase for authentication. As onActivityResult is now depraceted, I am trying to migrate my app to use registerForActivityResult. I have a link to Google account feature, that starts with the Google sign-in…
6
votes
0 answers

Default way to get request code in ActivityResultContract

Is there any default way to get the request code in ActivityResultContract? I know about StartActivityForResult contract, which returns ActivityResult, but there is no requestCode, only resultCode. I can do something like this, but maybe there is a…
2
votes
0 answers

Google Pay Push provisioning activity result with activity result launcher api

I'm trying to implement Google Pay push provisioning, and get a result from the activity provided by google where users go by the standard flow of adding a payment method in Google wallet. So the problem is that the…
2
votes
0 answers

Adding Intent setAction to the new Activity Result API ActivityResultLauncher when selecting Image from Gallery

I am using the new Activity Result API for launching and picking an image from Gallery the problem am having is how can i modify an Intent in the new Activity Result API to work like the old startActivityForResult Below is my old way of selecting…
1
vote
1 answer

Android ActivityResultContracts.CreateDocument onResult is never called

In my app it is supposed that users can choose a path to save their texts through SAF. I use ActivityResultContracts.CreateDocument to do this, which will provide the Uri of the created file so that I can operate on that file, such as writing…
Eynnzerr
  • 191
  • 2
  • 13
1
vote
1 answer

How safe is registering contracts with ActivityResultRegistry after onResume in android?

The following code gives me error as registering occurs after onResume: class TempActivity: AppCompatActivity(){ private lateinit var binding: ActivityTempBinding override fun onCreate(savedInstanceState: Bundle?) { …
1
vote
1 answer

How To Send Intent Back using ActivityLauncher API?

I've been using this method to try to send data between Activities, but Google don't show you how to send the data back from the other Activity. So I started looking for other methods that might work, and the only thing I could find was…
1
vote
0 answers

FirebaseUI needs pending intent

I have a code which goes to firebaseAuthUI with this activityResultLauncher: //used for login this.loginActivityLauncher = registerForActivityResult(new FirebaseAuthUIActivityResultContract(), result -> { String s; …
1
vote
0 answers

ActivityResultLauncher always returns null data

i'm using ActivityResultLauncher with ActivityResultContracts.StartIntentSenderForResult contract in android 11 to modify audio files. Here's how i'm doing it in my MainActivity: i use MediaStore to create a write request which returns a…
1
vote
0 answers

how to store URI of a file from gallery into local DB and access it (in kotlin preferably)

I have implemented ActvityResults API to get an image from gallery (or) directly from camera. for taking a image from camera it's simple create a file obj in your app's local directory. create a URI for file obj using ActivityResults API, send…
1
vote
1 answer

Activity result API's ActivityResultLauncher launch() method causes calling not only contract's createIntent() method but also parseResult()

I am on ActivityA, trying to start ActivityB with String input, make some work, and return String output back to ActivityA. I have created Activity Result API helper class, based on this tutorial and ActivityResultContract (both listed below). I…
1
vote
0 answers

Why is data passed by onActivityResult(int, int, Bundle) not type-safe Or why does Activity Result API make calling activity for result type-safe?

Jetpack offers a new solution, which is Activity Result API, to deprecate startActivityForResult and onActivityResult for Activity/Fragment passing data respectively. One of the reasons is that Activity Result API makes calling an activity for…
0
votes
1 answer

Does requiring an Play Services module in manifest.xml install for all apps or just the requestor

I'm implementing the PickVisualMediaRequest photo picker and have added the service to my manifest.xml telling Play Services to install its module for API levels under 30, as shown here:…
1
2