Callback from C++ code into my activity code

  android, android-ndk, c++

I’m bad in C++. I have the following object:

class Test{
    typedef std::function<void(float)> MyCallback;
public:
    void setCallback(MyCallback myCallback);
private:
    MyCallback mycallback = nullptr;
};

Now I have this method:

extern "C" JNIEXPORT void JNICALL
Java_app_path_Activity_setCallback(JNIEnv *env, jobject obj) {
}

The question is how can I set callback to get value in my Activity?

Source: Windows Questions C++

LEAVE A COMMENT