In my code I am trying to pass a function as a parameter.
The function has two arguments: a promise, and an int. I want to pass the promise with the parameter, and the int will be set by the child function.
public void getUser(final Promise promise) {
UserHelper.saveMe(getReactApplicationContext(), callBack(promise, int myInt));
}
public void callBack(Promise promise, int myInt){
if (user != null) {
promise.resolve(doSomething(myInt));
}
}
Child Function
public static void saveMe(Context context, function callBack) {
**some code here
returnUser(20);
}
I have done similar things in JS and PHP before, but I can't figure out how to run in Java.
Thanks for your help.