You definitely can NOT remove the local ref for the returned object, as this call will release the reference to the object. for instance
jbitmap = invokeObjectJavaMethod("MFImageToNative", "([B)Landroid/graphics/Bitmap;", byte_array); env->DeleteLocalRef(jbitmap); return jbitmap;
if it fails, I believe that the consumer of the method is responsible for releasing the link. Some soul could give me an explanation of how to do this, I would be very grateful.
source share