I want to feed buffer of the surface from Native code. So I get the surface from SurfaceView's SurfaceHolder's getSurface method. Now all I want is to use it from the native to feed buffer to render image. I have included SurfaceClinger/Surface.h. But when I try to get mSurface property, it throws error saying java.lang.NoSuchFieldException for mSurface. Any suggestion in this regard will be helpful.
code snippet:
Surface mSurface;
SurfaceHolder mSurfaceHolder;
mSurface = mSurfaceHolder.getSurface();
try{
class myClass = mSurface.getClass();
String fieldName = "mSurface";
Field field = myClass.getDeclaredField(fieldName);
field.setAccesssible(true);
int surfacePtr = field.getInt(mSurface);
nativeInterface.DrawOnSurface(surfacePtr);
}
catch(Exception ex){}
Thanks.