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
Modifier and TypeClassDescriptionstatic interface
Deprecated.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
ConstructorDescriptionFlutterActivityDelegate
(Activity activity, FlutterActivityDelegate.ViewFactory viewFactory) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Returns a reference to the Flutter view maintained by this object.boolean
Deprecated.Returns whether the specified plugin is known to this registry.boolean
onActivityResult
(int requestCode, int resultCode, Intent data) Deprecated.boolean
Deprecated.Invoked when the activity has detected the user's press of the back key.void
onConfigurationChanged
(Configuration newConfig) Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
onNewIntent
(Intent intent) Deprecated.void
onPause()
Deprecated.void
Deprecated.boolean
onRequestPermissionsResult
(int requestCode, String[] permissions, int[] grantResults) Deprecated.void
onResume()
Deprecated.void
onStart()
Deprecated.void
onStop()
Deprecated.void
onTrimMemory
(int level) Deprecated.void
Deprecated.void
onWindowFocusChanged
(boolean hasFocus) Deprecated.registrarFor
(String pluginKey) Deprecated.Returns aPluginRegistry.Registrar
for receiving the registrations pertaining to the specified plugin.<T> T
valuePublishedByPlugin
(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.Provider
Returns a reference to the Flutter view maintained by this object. This may benull
.- Specified by:
getFlutterView
in interfaceFlutterView.Provider
- Returns:
- a reference to the Flutter view maintained by this object.
-
hasPlugin
Deprecated.Description copied from interface:PluginRegistry
Returns whether the specified plugin is known to this registry.- Specified by:
hasPlugin
in 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:PluginRegistry
Returns 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:
valuePublishedByPlugin
in 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:PluginRegistry
Returns aPluginRegistry.Registrar
for receiving the registrations pertaining to the specified plugin.- Specified by:
registrarFor
in interfacePluginRegistry
- Parameters:
pluginKey
- a unique String identifying the plugin; typically the fully qualified name of the plugin's main class.- Returns:
- A
PluginRegistry.Registrar
for receiving the registrations pertianing to the specified plugin.
-
onRequestPermissionsResult
public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) Deprecated.- Specified by:
onRequestPermissionsResult
in 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_GRANTED
orPackageManager.PERMISSION_DENIED
.- Returns:
- true if the result has been handled.
-
onActivityResult
Deprecated.- Specified by:
onActivityResult
in 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:
onCreate
in 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:
onNewIntent
in interfaceFlutterActivityEvents
- Parameters:
intent
- The new intent that was started for the activity.- See Also:
-
onPause
public void onPause()Deprecated.- Specified by:
onPause
in interfaceFlutterActivityEvents
- See Also:
-
onStart
public void onStart()Deprecated.- Specified by:
onStart
in interfaceFlutterActivityEvents
- See Also:
-
onResume
public void onResume()Deprecated.- Specified by:
onResume
in interfaceFlutterActivityEvents
- See Also:
-
onStop
public void onStop()Deprecated.- Specified by:
onStop
in interfaceFlutterActivityEvents
- See Also:
-
onPostResume
public void onPostResume()Deprecated.- Specified by:
onPostResume
in interfaceFlutterActivityEvents
- See Also:
-
onDestroy
public void onDestroy()Deprecated.- Specified by:
onDestroy
in interfaceFlutterActivityEvents
- See Also:
-
onBackPressed
public boolean onBackPressed()Deprecated.Description copied from interface:FlutterActivityEvents
Invoked when the activity has detected the user's press of the back key.- Specified by:
onBackPressed
in interfaceFlutterActivityEvents
- Returns:
true
if the listener handled the event;false
to let the activity continue with its default back button handling.- See Also:
-
onUserLeaveHint
public void onUserLeaveHint()Deprecated.- Specified by:
onUserLeaveHint
in interfaceFlutterActivityEvents
- See Also:
-
onWindowFocusChanged
public void onWindowFocusChanged(boolean hasFocus) Deprecated.- Specified by:
onWindowFocusChanged
in interfaceFlutterActivityEvents
- Parameters:
hasFocus
- True if the current activity window has focus.- See Also:
-
onTrimMemory
public void onTrimMemory(int level) Deprecated.- Specified by:
onTrimMemory
in interfaceComponentCallbacks2
-
onLowMemory
public void onLowMemory()Deprecated.- Specified by:
onLowMemory
in interfaceComponentCallbacks
-
onConfigurationChanged
Deprecated.- Specified by:
onConfigurationChanged
in interfaceComponentCallbacks
-
FlutterActivity
is the new API that now replaces this class andFlutterActivity
. See https://flutter.dev/go/android-project-migration for more migration details.