How can I call object method inside static method
-
hi, i can successfully call my android java functions from c++. and I get callback this functions like this.
Java Native Method
public native void vpnStatusChanged(String status);C++ area

I can successfully print the incoming value to the screen. But I can't call these methods
setVpnStatus()
-
hi, i can successfully call my android java functions from c++. and I get callback this functions like this.
Java Native Method
public native void vpnStatusChanged(String status);C++ area

I can successfully print the incoming value to the screen. But I can't call these methods
setVpnStatus()
@NullByte said in How can I call object method inside static method:
But I can't call these methods
You need the instance of that class.
There are different ways to do this. One is to make this class a singleton. Or you simply put a pointer variable of type Android* in the cpp file and assign it in the constructor:Android *instance{nullptr}; Android::Android(...) { instance = this; } void Android::onVPNStatusChanged(...) { if (instance) instance->setVpnStatus... }And please post code as text, not images. Code is text.
-
System has marked this topic as solved on