I'm writing code in C++ for Android. The main code is written in Java, but I would like to start another thread invoked from JNI call and access assets from C++. However, when I pass AAssetsManager from getAssets(), it works only within scope of JNI function call. When other thread tries to use, I get an invalid pointer. I also made sure that the object AAssetsManager is not garbage collected by writing it to a static variable. Do you have any advice on how I could make it work?
Thanks
I'm writing code in C++ for Android. The main code is written in Java, but I would like to start another thread invoked from JNI call and access assets from C++. However, when I pass AAssetsManager from getAssets(), it works only within scope of JNI function call. When other thread tries to use, I get an invalid pointer. I also made sure that the object AAssetsManager is not garbage collected by writing it to a static variable. Do you have any advice on how I could make it work?
AttachCurrentThread() at some point).