I launch the activation with the choice of the file with the following code:

Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("*/*"); intent.addCategory(Intent.CATEGORY_OPENABLE); ctx.startActivity(intent); 

Is there any possibility to get the result of executing this activity without using a bunch of startActivityForResult and onActivityResult ? Because it is assumed that the code can be called from different activites. So, overloading the onActivityResult method with any particular activation will fail.

    1 answer 1

    The fact is that with this method of launching an Activity (as you described), you cannot know in advance which Activity will be launched. A rather complex search engine will be launched to find a suitable activity, and if there is no default, then the user will be presented with a list of them from where he can select the right one.

    So there are onActivityResult options for onActivityResult . Even if the code will be launched from many Activity nothing prevents you from making a single parent class and placing onActivityResult there - so the code will be one and you will not need to reinvent the wheel. OOP taxis!

    • It’s not quite clear how any activation of any kind can be triggered by the fact that I can’t get a result from somewhere other than activation :( As for the parent class, this is understandable. It was just assumed that the dialogue was started from code who doesn’t know about activations at all. And so, I’ll have to make some kind of curved backups - angry