I want to use onActivityResult in a class which not extends activity but this class has a global variable as an instance of activity. This class is similar to this :
public class myClass(){
public Activity myActivity;
.
.
.
// I want to add onMyActivityResult here
}
I am looking for something like this:
myActivity.setOnActivityResult...
Thanks!
you could do the following
public class myClass(){
public static void activityResult(int requestCode, int resultCode, Intent data){
//right your code here .
}
}
and in your CLASS EXTENDS ACTIVITY write this inside the onActivityResult Method :
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
myClass.activityResult(requestCode,resultCode,data);
}
thnx to this answer :https://stackoverflow.com/a/21780532/3818437