Package io.flutter.view
Interface TextureRegistry.SurfaceProducer.Callback
- Enclosing interface:
- TextureRegistry.SurfaceProducer
public static interface TextureRegistry.SurfaceProducer.Callback
Callback invoked by
TextureRegistry.SurfaceProducer.setCallback(Callback)
.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Invoked when an Android application is resumed afteronSurfaceDestroyed()
.default void
Deprecated, for removal: This API element is subject to removal in a future version.void
Invoked when aSurface
returned byTextureRegistry.SurfaceProducer.getSurface()
is invalid.
-
Method Details
-
onSurfaceCreated
Deprecated, for removal: This API element is subject to removal in a future version.Override and useonSurfaceAvailable()
instead.An alias foronSurfaceAvailable()
with a less accurate name. -
onSurfaceAvailable
default void onSurfaceAvailable()Invoked when an Android application is resumed afteronSurfaceDestroyed()
.Applications should now call
TextureRegistry.SurfaceProducer.getSurface()
to get a newSurface
, as the previous one was destroyed and released as a result of a low memory event from the Android OS.void example(SurfaceProducer producer) { producer.setCallback(new SurfaceProducer.Callback() { @override public void onSurfaceAvailable() { Surface surface = producer.getSurface(); redrawOrUse(surface); } // ... }); }
-
onSurfaceDestroyed
void onSurfaceDestroyed()Invoked when aSurface
returned byTextureRegistry.SurfaceProducer.getSurface()
is invalid.In a low memory environment, the Android OS will signal to Flutter to release resources, such as surfaces, that are not currently in use, such as when the application is in the background, and this method is subsequently called to notify a plugin author to stop using or rendering to the last surface.
Use
onSurfaceAvailable()
to be notified to resume rendering.void example(SurfaceProducer producer) { producer.setCallback(new SurfaceProducer.Callback() { @override public void onSurfaceDestroyed() { // Store information about the last frame, if necessary. // Potentially release other dependent resources. } // ... }); }
-
onSurfaceAvailable()
instead.