Reputation: 770
I am using at the moment android_view_Surface_getSurface() in my JNI code to get the native Surface from the Java Surface object. This seems to work on Android 4.4 devices but not on devices with older OS versions, I tested with 4.1 for example, looks like symbol android_view_Surface_getSurface is missing in system libraries.
Is there approach that works on all devices? (or at least 4+). If not, how to do this just for older OS versions?
Thanks, Sasha
Upvotes: 2
Views: 3704
Reputation: 57203
You have it as public API in .
/**
* Return the ANativeWindow associated with a Java Surface object,
* for interacting with it through native code. This acquires a reference
* on the ANativeWindow that is returned; be sure to use ANativeWindow_release()
* when done with it so that it doesn't leak.
*/
ANativeWindow* ANativeWindow_fromSurface(JNIEnv* env, jobject surface);
See example here: Application crashing due to use of ANativeWindow API
Upvotes: 4