Class FlutterActivityDelegate
- All Implemented Interfaces:
ComponentCallbacks,ComponentCallbacks2,FlutterActivityEvents,PluginRegistry,PluginRegistry.ActivityResultListener,PluginRegistry.RequestPermissionsResultListener,FlutterView.Provider
Activity
instances to Flutter.
This exists as a dedicated class (as opposed to being integrated directly into FlutterActivity) to facilitate applications that don't wish to subclass FlutterActivity.
The most obvious example of when this may come in handy is if an application wishes to subclass
the Android v4 support library's FragmentActivity.
Usage:
To wire this class up to your activity, simply forward the events defined in FlutterActivityEvents from your activity to an instance of this class. Optionally, you can make
your activity implement PluginRegistry and/or FlutterView.Provider and forward those methods to this class as well.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDeprecated.Specifies the mechanism by which Flutter views are created during the operation of aFlutterActivityDelegate.Nested classes/interfaces inherited from interface io.flutter.plugin.common.PluginRegistry
PluginRegistry.ActivityResultListener, PluginRegistry.NewIntentListener, PluginRegistry.PluginRegistrantCallback, PluginRegistry.Registrar, PluginRegistry.RequestPermissionsResultListener, PluginRegistry.UserLeaveHintListener, PluginRegistry.ViewDestroyListener, PluginRegistry.WindowFocusChangedListener -
Field Summary
Fields inherited from interface android.content.ComponentCallbacks2
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN -
Constructor Summary
ConstructorsConstructorDescriptionFlutterActivityDelegate(Activity activity, FlutterActivityDelegate.ViewFactory viewFactory) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Returns a reference to the Flutter view maintained by this object.booleanDeprecated.Returns whether the specified plugin is known to this registry.booleanonActivityResult(int requestCode, int resultCode, Intent data) Deprecated.booleanDeprecated.Invoked when the activity has detected the user's press of the back key.voidonConfigurationChanged(Configuration newConfig) Deprecated.voidDeprecated.voidDeprecated.voidDeprecated.voidonNewIntent(Intent intent) Deprecated.voidonPause()Deprecated.voidDeprecated.booleanonRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) Deprecated.voidonResume()Deprecated.voidonStart()Deprecated.voidonStop()Deprecated.voidonTrimMemory(int level) Deprecated.voidDeprecated.voidonWindowFocusChanged(boolean hasFocus) Deprecated.registrarFor(String pluginKey) Deprecated.Returns aPluginRegistry.Registrarfor receiving the registrations pertaining to the specified plugin.<T> TvaluePublishedByPlugin(String pluginKey) Deprecated.Returns the value published by the specified plugin, if any.
-
Constructor Details
-
FlutterActivityDelegate
Deprecated.
-
-
Method Details
-
getFlutterView
Deprecated.Description copied from interface:FlutterView.ProviderReturns a reference to the Flutter view maintained by this object. This may benull.- Specified by:
getFlutterViewin interfaceFlutterView.Provider- Returns:
- a reference to the Flutter view maintained by this object.
-
hasPlugin
Deprecated.Description copied from interface:PluginRegistryReturns whether the specified plugin is known to this registry.- Specified by:
hasPluginin interfacePluginRegistry- Parameters:
key- a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.- Returns:
- true if this registry has handed out a registrar for the specified plugin.
-
valuePublishedByPlugin
Deprecated.Description copied from interface:PluginRegistryReturns the value published by the specified plugin, if any.Plugins may publish a single value, such as an instance of the plugin's main class, for situations where external control or interaction is needed. Clients are expected to know the value's type.
- Specified by:
valuePublishedByPluginin interfacePluginRegistry- Type Parameters:
T- The type of the value.- Parameters:
pluginKey- a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.- Returns:
- the published value, possibly null.
-
registrarFor
Deprecated.Description copied from interface:PluginRegistryReturns aPluginRegistry.Registrarfor receiving the registrations pertaining to the specified plugin.- Specified by:
registrarForin interfacePluginRegistry- Parameters:
pluginKey- a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.- Returns:
- A
PluginRegistry.Registrarfor receiving the registrations pertianing to the specified plugin.
-
onRequestPermissionsResult
public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) Deprecated.- Specified by:
onRequestPermissionsResultin interfacePluginRegistry.RequestPermissionsResultListener- Parameters:
requestCode- The request code passed inActivityCompat.requestPermissions(android.app.Activity, String[], int).permissions- The requested permissions.grantResults- The grant results for the corresponding permissions which is eitherPackageManager.PERMISSION_GRANTEDorPackageManager.PERMISSION_DENIED.- Returns:
- true if the result has been handled.
-
onActivityResult
Deprecated.- Specified by:
onActivityResultin interfacePluginRegistry.ActivityResultListener- Parameters:
requestCode- The integer request code originally supplied tostartActivityForResult(), allowing you to identify who this result came from.resultCode- The integer result code returned by the child activity through itssetResult().data- An Intent, which can return result data to the caller (various data can be attached to Intent "extras").- Returns:
- true if the result has been handled.
-
onCreate
Deprecated.- Specified by:
onCreatein interfaceFlutterActivityEvents- Parameters:
savedInstanceState- If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied inonSaveInstanceState(Bundle).- See Also:
-
onNewIntent
Deprecated.- Specified by:
onNewIntentin interfaceFlutterActivityEvents- Parameters:
intent- The new intent that was started for the activity.- See Also:
-
onPause
public void onPause()Deprecated.- Specified by:
onPausein interfaceFlutterActivityEvents- See Also:
-
onStart
public void onStart()Deprecated.- Specified by:
onStartin interfaceFlutterActivityEvents- See Also:
-
onResume
public void onResume()Deprecated.- Specified by:
onResumein interfaceFlutterActivityEvents- See Also:
-
onStop
public void onStop()Deprecated.- Specified by:
onStopin interfaceFlutterActivityEvents- See Also:
-
onPostResume
public void onPostResume()Deprecated.- Specified by:
onPostResumein interfaceFlutterActivityEvents- See Also:
-
onDestroy
public void onDestroy()Deprecated.- Specified by:
onDestroyin interfaceFlutterActivityEvents- See Also:
-
onBackPressed
public boolean onBackPressed()Deprecated.Description copied from interface:FlutterActivityEventsInvoked when the activity has detected the user's press of the back key.- Specified by:
onBackPressedin interfaceFlutterActivityEvents- Returns:
trueif the listener handled the event;falseto let the activity continue with its default back button handling.- See Also:
-
onUserLeaveHint
public void onUserLeaveHint()Deprecated.- Specified by:
onUserLeaveHintin interfaceFlutterActivityEvents- See Also:
-
onWindowFocusChanged
public void onWindowFocusChanged(boolean hasFocus) Deprecated.- Specified by:
onWindowFocusChangedin interfaceFlutterActivityEvents- Parameters:
hasFocus- True if the current activity window has focus.- See Also:
-
onTrimMemory
public void onTrimMemory(int level) Deprecated.- Specified by:
onTrimMemoryin interfaceComponentCallbacks2
-
onLowMemory
public void onLowMemory()Deprecated.- Specified by:
onLowMemoryin interfaceComponentCallbacks
-
onConfigurationChanged
Deprecated.- Specified by:
onConfigurationChangedin interfaceComponentCallbacks
-
FlutterActivityis the new API that now replaces this class andFlutterActivity. See https://flutter.dev/go/android-project-migration for more migration details.