My workaround for the time being is as follows:
Construct the Java class when the related C++ class is constructed
Set Activity for the class
Call static methods like before
Java:
private static Activity m_activity = null;
public void setActivity(Activity activity) {
m_activity = activity;
return;
}
also change all methods that previously called QtNative.activity() to now check for and use m_activity instead.
C++:
mJNIInstance = QJniObject("the/qualified/ClassPath");
if (mJNIInstance.isValid()) {
mJNIInstance.callMethod<void>("setActivity", "(Landroid/app/Activity;)V", QNativeInterface::QAndroidApplication::context().object());
} else {
// output a warning or error
}