I
I
Igor-Novikov2020-02-04 16:54:25
Android
Igor-Novikov, 2020-02-04 16:54:25

How to pass the result of intent execution to the current fragment?

There is a code that launches an intent to access External Storage.

Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("text/*");
getTargetFragment().startActivityForResult(intent, READ_REQUEST_CODE);

The result is sent to the onActivityResult() method of the fragment's target.
I can also send this result to the same method in Activity.
Is there a way to accept the result in the same fragment from which we call the intent?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question