Interface FlutterActivityDelegate.ViewFactory

All Known Implementing Classes:
FlutterActivity, FlutterFragmentActivity
Enclosing class:
FlutterActivityDelegate

public static interface FlutterActivityDelegate.ViewFactory
Specifies the mechanism by which Flutter views are created during the operation of a FlutterActivityDelegate.

A delegate's view factory will be consulted during FlutterActivityDelegate.onCreate(Bundle). If it returns null, then the delegate will fall back to instantiating a new full-screen FlutterView.

A delegate's native view factory will be consulted during FlutterActivityDelegate.onCreate(Bundle). If it returns null, then the delegate will fall back to instantiating a new FlutterNativeView. This is useful for applications to override to reuse the FlutterNativeView held e.g. by a pre-existing background service.

  • Method Details

    • createFlutterView

      FlutterView createFlutterView(Context context)
    • createFlutterNativeView

      FlutterNativeView createFlutterNativeView()
    • retainFlutterNativeView

      boolean retainFlutterNativeView()
      Hook for subclasses to indicate that the FlutterNativeView returned by createFlutterNativeView() should not be destroyed when this activity is destroyed.
      Returns:
      Whether the FlutterNativeView is retained.