Question

I would simply like to know if I can handle on onActivityResult() from another class besides the one it is called in?

So if I have Activity A then Activity B.

Activity B calls onActivityResult(i, 1).

Could Activity A handle this response Like so

onActivityResult(){
   if(resultCode == Activity.RESULT_OK){
      switch(requestCode){
case 1:
//handle data of image path.
break;
    }
  }
}
Was it helpful?

Solution

The FLow is like this:

A Means Class 1 B Means Class 2

A.startActivityForResult() -> B.setResult() -> A.onActivityResult()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top