How to use Activity Results API in react native android?

Viewed 102

I am trying to create android native module for react native and I am using Activity Results API to start another activity. But registerForActivityResult is not found, even I have these two dependencies listed in the Gradle:

implementation "androidx.activity:activity:1.2.0"
implementation "androidx.fragment:fragment:1.3.0"

This is what I am trying to achieve:

ActivityResultLauncher<String> mGetContent = registerForActivityResult(new GetContent(),
    new ActivityResultCallback<Uri>() {
        @Override
        public void onActivityResult(Uri uri) {
            // Handle the returned Uri
        }
    }
);
0 Answers
Related