Class FlutterView

All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, KeyboardManager.ViewDelegate, BinaryMessenger, io.flutter.plugin.mouse.MouseCursorPlugin.MouseCursorViewDelegate, TextureRegistry

@Deprecated public class FlutterView extends SurfaceView implements BinaryMessenger, TextureRegistry, io.flutter.plugin.mouse.MouseCursorPlugin.MouseCursorViewDelegate, KeyboardManager.ViewDelegate
Deprecated.
FlutterView is the new API that now replaces this class. See https://flutter.cn/go/android-project-migration for more migration details.
Deprecated Android view containing a Flutter app.
  • Constructor Details

  • Method Details

    • getDartExecutor

      @NonNull public DartExecutor getDartExecutor()
      Deprecated.
    • dispatchKeyEvent

      public boolean dispatchKeyEvent(KeyEvent event)
      Deprecated.
      Overrides:
      dispatchKeyEvent in class View
    • getFlutterNativeView

      public FlutterNativeView getFlutterNativeView()
      Deprecated.
    • getPluginRegistry

      public FlutterPluginRegistry getPluginRegistry()
      Deprecated.
    • getLookupKeyForAsset

      public String getLookupKeyForAsset(String asset)
      Deprecated.
    • getLookupKeyForAsset

      public String getLookupKeyForAsset(String asset, String packageName)
      Deprecated.
    • addActivityLifecycleListener

      public void addActivityLifecycleListener(ActivityLifecycleListener listener)
      Deprecated.
    • onStart

      public void onStart()
      Deprecated.
    • onPause

      public void onPause()
      Deprecated.
    • onPostResume

      public void onPostResume()
      Deprecated.
    • onStop

      public void onStop()
      Deprecated.
    • onMemoryPressure

      public void onMemoryPressure()
      Deprecated.
    • hasRenderedFirstFrame

      public boolean hasRenderedFirstFrame()
      Deprecated.
      Returns true if the Flutter experience associated with this FlutterView has rendered its first frame, or false otherwise.
    • addFirstFrameListener

      public void addFirstFrameListener(FlutterView.FirstFrameListener listener)
      Deprecated.
      Provide a listener that will be called once when the FlutterView renders its first frame to the underlaying SurfaceView.
    • removeFirstFrameListener

      public void removeFirstFrameListener(FlutterView.FirstFrameListener listener)
      Deprecated.
      Remove an existing first frame listener.
    • enableBufferingIncomingMessages

      public void enableBufferingIncomingMessages()
      Deprecated.
      Description copied from interface: BinaryMessenger
      Enables the ability to queue messages received from Dart.

      This is useful when there are pending channel handler registrations. For example, Dart may be initialized concurrently, and prior to the registration of the channel handlers. This implies that Dart may start sending messages while plugins are being registered.

      Specified by:
      enableBufferingIncomingMessages in interface BinaryMessenger
    • disableBufferingIncomingMessages

      public void disableBufferingIncomingMessages()
      Deprecated.
      Description copied from interface: BinaryMessenger
      Disables the ability to queue messages received from Dart.

      This can be used after all pending channel handlers have been registered.

      Specified by:
      disableBufferingIncomingMessages in interface BinaryMessenger
    • disableTransparentBackground

      public void disableTransparentBackground()
      Deprecated.
      Reverts this back to the SurfaceView defaults, at the back of its window and opaque.
    • setInitialRoute

      public void setInitialRoute(String route)
      Deprecated.
    • pushRoute

      public void pushRoute(String route)
      Deprecated.
    • popRoute

      public void popRoute()
      Deprecated.
    • startBackGesture

      @RequiresApi(34) public void startBackGesture(@NonNull BackEvent backEvent)
      Deprecated.
    • updateBackGestureProgress

      @RequiresApi(34) public void updateBackGestureProgress(@NonNull BackEvent backEvent)
      Deprecated.
    • commitBackGesture

      @RequiresApi(34) public void commitBackGesture()
      Deprecated.
    • cancelBackGesture

      @RequiresApi(34) public void cancelBackGesture()
      Deprecated.
    • onConfigurationChanged

      protected void onConfigurationChanged(Configuration newConfig)
      Deprecated.
      Overrides:
      onConfigurationChanged in class View
    • detach

      public FlutterNativeView detach()
      Deprecated.
    • destroy

      public void destroy()
      Deprecated.
    • onCreateInputConnection

      public InputConnection onCreateInputConnection(EditorInfo outAttrs)
      Deprecated.
      Overrides:
      onCreateInputConnection in class View
    • checkInputConnectionProxy

      public boolean checkInputConnectionProxy(View view)
      Deprecated.
      Overrides:
      checkInputConnectionProxy in class View
    • onProvideAutofillVirtualStructure

      public void onProvideAutofillVirtualStructure(ViewStructure structure, int flags)
      Deprecated.
      Overrides:
      onProvideAutofillVirtualStructure in class View
    • autofill

      public void autofill(SparseArray<AutofillValue> values)
      Deprecated.
      Overrides:
      autofill in class View
    • onTouchEvent

      public boolean onTouchEvent(MotionEvent event)
      Deprecated.
      Overrides:
      onTouchEvent in class View
    • onHoverEvent

      public boolean onHoverEvent(MotionEvent event)
      Deprecated.
      Overrides:
      onHoverEvent in class View
    • onGenericMotionEvent

      public boolean onGenericMotionEvent(MotionEvent event)
      Deprecated.
      Invoked by Android when a generic motion event occurs, e.g., joystick movement, mouse hover, track pad touches, scroll wheel movements, etc.

      Flutter handles all of its own gesture detection and processing, therefore this method forwards all MotionEvent data from Android to Flutter.

      Overrides:
      onGenericMotionEvent in class View
    • onSizeChanged

      protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight)
      Deprecated.
      Overrides:
      onSizeChanged in class View
    • onApplyWindowInsets

      public final WindowInsets onApplyWindowInsets(WindowInsets insets)
      Deprecated.
      Overrides:
      onApplyWindowInsets in class View
    • runFromBundle

      public void runFromBundle(FlutterRunArguments args)
      Deprecated.
    • getBitmap

      public Bitmap getBitmap()
      Deprecated.
      Return the most recent frame as a bitmap.
      Returns:
      A bitmap.
    • onFirstFrame

      public void onFirstFrame()
      Deprecated.
    • onAttachedToWindow

      protected void onAttachedToWindow()
      Deprecated.
      Overrides:
      onAttachedToWindow in class SurfaceView
    • onDetachedFromWindow

      protected void onDetachedFromWindow()
      Deprecated.
      Overrides:
      onDetachedFromWindow in class SurfaceView
    • getAccessibilityNodeProvider

      public AccessibilityNodeProvider getAccessibilityNodeProvider()
      Deprecated.
      Overrides:
      getAccessibilityNodeProvider in class View
    • getSystemPointerIcon

      @RequiresApi(24) @NonNull public PointerIcon getSystemPointerIcon(int type)
      Deprecated.
      Description copied from interface: io.flutter.plugin.mouse.MouseCursorPlugin.MouseCursorViewDelegate
      Gets a system pointer icon object for the given type.

      If typeis not recognized, returns the default pointer icon.

      This is typically implemented by calling PointerIcon.getSystemIcon(android.content.Context, int) with the context associated with this view.

      Specified by:
      getSystemPointerIcon in interface io.flutter.plugin.mouse.MouseCursorPlugin.MouseCursorViewDelegate
    • getBinaryMessenger

      public BinaryMessenger getBinaryMessenger()
      Deprecated.
      Description copied from interface: KeyboardManager.ViewDelegate
      Returns a BinaryMessenger to send platform messages with.
      Specified by:
      getBinaryMessenger in interface KeyboardManager.ViewDelegate
    • onTextInputKeyEvent

      public boolean onTextInputKeyEvent(@NonNull KeyEvent keyEvent)
      Deprecated.
      Description copied from interface: KeyboardManager.ViewDelegate
      Send a KeyEvent that is not handled by the keyboard responders to the text input system.
      Specified by:
      onTextInputKeyEvent in interface KeyboardManager.ViewDelegate
      Parameters:
      keyEvent - the KeyEvent that should be processed by the text input system. It must not be null.
      Returns:
      Whether the text input handles the key event.
    • redispatch

      public void redispatch(@NonNull KeyEvent keyEvent)
      Deprecated.
      Description copied from interface: KeyboardManager.ViewDelegate
      Send a KeyEvent that is not handled by Flutter back to the platform.
      Specified by:
      redispatch in interface KeyboardManager.ViewDelegate
    • makeBackgroundTaskQueue

      @UiThread public BinaryMessenger.TaskQueue makeBackgroundTaskQueue(BinaryMessenger.TaskQueueOptions options)
      Deprecated.
      Description copied from interface: BinaryMessenger
      Creates a TaskQueue that executes the tasks serially on a background thread.

      BinaryMessenger.TaskQueueOptions can be used to configure the task queue to execute tasks concurrently. Doing so can be more performant, though users need to ensure that the task handlers are thread-safe.

      Specified by:
      makeBackgroundTaskQueue in interface BinaryMessenger
    • send

      @UiThread public void send(String channel, ByteBuffer message)
      Deprecated.
      Description copied from interface: BinaryMessenger
      Sends a binary message to the Flutter application.
      Specified by:
      send in interface BinaryMessenger
      Parameters:
      channel - the name String of the logical channel used for the message.
      message - the message payload, a direct-allocated ByteBuffer with the message bytes between position zero and current position, or null.
    • send

      @UiThread public void send(String channel, ByteBuffer message, BinaryMessenger.BinaryReply callback)
      Deprecated.
      Description copied from interface: BinaryMessenger
      Sends a binary message to the Flutter application, optionally expecting a reply.

      Any uncaught exception thrown by the reply callback will be caught and logged.

      Specified by:
      send in interface BinaryMessenger
      Parameters:
      channel - the name String of the logical channel used for the message.
      message - the message payload, a direct-allocated ByteBuffer with the message bytes between position zero and current position, or null.
      callback - a BinaryMessenger.BinaryReply callback invoked when the Flutter application responds to the message, possibly null.
    • setMessageHandler

      @UiThread public void setMessageHandler(@NonNull String channel, @NonNull BinaryMessenger.BinaryMessageHandler handler)
      Deprecated.
      Description copied from interface: BinaryMessenger
      Registers a handler to be invoked when the Flutter application sends a message to its host platform.

      Registration overwrites any previous registration for the same channel name. Use a null handler to deregister.

      If no handler has been registered for a particular channel, any incoming message on that channel will be handled silently by sending a null reply.

      Specified by:
      setMessageHandler in interface BinaryMessenger
      Parameters:
      channel - the name String of the channel.
      handler - a BinaryMessenger.BinaryMessageHandler to be invoked on incoming messages, or null.
    • setMessageHandler

      @UiThread public void setMessageHandler(@NonNull String channel, @NonNull BinaryMessenger.BinaryMessageHandler handler, @NonNull BinaryMessenger.TaskQueue taskQueue)
      Deprecated.
      Description copied from interface: BinaryMessenger
      Registers a handler to be invoked when the Flutter application sends a message to its host platform.

      Registration overwrites any previous registration for the same channel name. Use a null handler to deregister.

      If no handler has been registered for a particular channel, any incoming message on that channel will be handled silently by sending a null reply.

      Specified by:
      setMessageHandler in interface BinaryMessenger
      Parameters:
      channel - the name String of the channel.
      handler - a BinaryMessenger.BinaryMessageHandler to be invoked on incoming messages, or null.
      taskQueue - a BinaryMessenger.TaskQueue that specifies what thread will execute the handler. Specifying null means execute on the platform thread.
    • createSurfaceTexture

      @NonNull public TextureRegistry.SurfaceTextureEntry createSurfaceTexture()
      Deprecated.
      Description copied from interface: TextureRegistry
      Creates and registers a SurfaceTexture managed by the Flutter engine.
      Specified by:
      createSurfaceTexture in interface TextureRegistry
      Returns:
      A SurfaceTextureEntry.
    • createImageTexture

      @NonNull public TextureRegistry.ImageTextureEntry createImageTexture()
      Deprecated.
      Description copied from interface: TextureRegistry
      Creates and registers a texture managed by the Flutter engine.
      Specified by:
      createImageTexture in interface TextureRegistry
      Returns:
      a ImageTextureEntry.
    • createSurfaceProducer

      @NonNull public TextureRegistry.SurfaceProducer createSurfaceProducer()
      Deprecated.
      Description copied from interface: TextureRegistry
      Creates and registers a SurfaceProducer texture managed by the Flutter engine.
      Specified by:
      createSurfaceProducer in interface TextureRegistry
      Returns:
      A SurfaceProducer.
    • registerSurfaceTexture

      @NonNull public TextureRegistry.SurfaceTextureEntry registerSurfaceTexture(@NonNull SurfaceTexture surfaceTexture)
      Deprecated.
      Description copied from interface: TextureRegistry
      Registers a SurfaceTexture managed by the Flutter engine.
      Specified by:
      registerSurfaceTexture in interface TextureRegistry
      Returns:
      A SurfaceTextureEntry.