FlutterActivity is the new API that now replaces
this class and FlutterActivity. See
https://flutter.dev/go/android-project-migration for more migration details.@Deprecated public final class FlutterActivityDelegate extends Object implements FlutterActivityEvents, FlutterView.Provider, PluginRegistry
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.
| Modifier and Type | Class and Description |
|---|---|
static interface |
FlutterActivityDelegate.ViewFactory
Deprecated.
Specifies the mechanism by which Flutter views are created during the operation of a
FlutterActivityDelegate. |
PluginRegistry.ActivityResultListener, PluginRegistry.NewIntentListener, PluginRegistry.PluginRegistrantCallback, PluginRegistry.Registrar, PluginRegistry.RequestPermissionsResultListener, PluginRegistry.UserLeaveHintListener, PluginRegistry.ViewDestroyListenerTRIM_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 and Description |
|---|
FlutterActivityDelegate(Activity activity,
FlutterActivityDelegate.ViewFactory viewFactory)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
FlutterView |
getFlutterView()
Deprecated.
Returns a reference to the Flutter view maintained by this object.
|
boolean |
hasPlugin(String key)
Deprecated.
Returns whether the specified plugin is known to this registry.
|
boolean |
onActivityResult(int requestCode,
int resultCode,
Intent data)
Deprecated.
|
boolean |
onBackPressed()
Deprecated.
Invoked when the activity has detected the user's press of the back key.
|
void |
onConfigurationChanged(Configuration newConfig)
Deprecated.
|
void |
onCreate(Bundle savedInstanceState)
Deprecated.
|
void |
onDestroy()
Deprecated.
|
void |
onLowMemory()
Deprecated.
|
void |
onNewIntent(Intent intent)
Deprecated.
|
void |
onPause()
Deprecated.
|
void |
onPostResume()
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 |
onUserLeaveHint()
Deprecated.
|
PluginRegistry.Registrar |
registrarFor(String pluginKey)
Deprecated.
Returns a
PluginRegistry.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.
|
public FlutterActivityDelegate(Activity activity, FlutterActivityDelegate.ViewFactory viewFactory)
public FlutterView getFlutterView()
FlutterView.Providernull.getFlutterView in interface FlutterView.Providerpublic boolean hasPlugin(String key)
PluginRegistryhasPlugin in interface PluginRegistrykey - a unique String identifying the plugin; typically the fully qualified name of
the plugin's main class.public <T> T valuePublishedByPlugin(String pluginKey)
PluginRegistryPlugins 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.
valuePublishedByPlugin in interface PluginRegistryT - The type of the value.pluginKey - a unique String identifying the plugin; typically the fully qualified name of
the plugin's main class.public PluginRegistry.Registrar registrarFor(String pluginKey)
PluginRegistryPluginRegistry.Registrar for receiving the registrations pertaining to the specified plugin.registrarFor in interface PluginRegistrypluginKey - a unique String identifying the plugin; typically the fully qualified name of
the plugin's main class.PluginRegistry.Registrar for receiving the registrations pertianing to the specified plugin.public boolean onRequestPermissionsResult(int requestCode,
String[] permissions,
int[] grantResults)
onRequestPermissionsResult in interface PluginRegistry.RequestPermissionsResultListenerpublic boolean onActivityResult(int requestCode,
int resultCode,
Intent data)
onActivityResult in interface PluginRegistry.ActivityResultListenerpublic void onCreate(Bundle savedInstanceState)
onCreate in interface FlutterActivityEventsActivity.onCreate(android.os.Bundle)public void onNewIntent(Intent intent)
onNewIntent in interface FlutterActivityEventsActivity.onNewIntent(Intent)public void onPause()
onPause in interface FlutterActivityEventsActivity.onPause()public void onStart()
onStart in interface FlutterActivityEventsActivity.onStart()public void onResume()
onResume in interface FlutterActivityEventsActivity.onResume()public void onStop()
onStop in interface FlutterActivityEventsActivity.onStop()public void onPostResume()
onPostResume in interface FlutterActivityEventsActivity.onPostResume()public void onDestroy()
onDestroy in interface FlutterActivityEventsActivity.onDestroy()public boolean onBackPressed()
FlutterActivityEventsonBackPressed in interface FlutterActivityEventstrue if the listener handled the event; false to let the activity
continue with its default back button handling.Activity.onBackPressed()public void onUserLeaveHint()
onUserLeaveHint in interface FlutterActivityEventsActivity.onUserLeaveHint()public void onTrimMemory(int level)
onTrimMemory in interface ComponentCallbacks2public void onLowMemory()
onLowMemory in interface ComponentCallbackspublic void onConfigurationChanged(Configuration newConfig)
onConfigurationChanged in interface ComponentCallbacks