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
.
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 . |
ComponentCallbacks2.TrimMemoryLevel
PluginRegistry.ActivityResultListener, PluginRegistry.NewIntentListener, PluginRegistry.PluginRegistrantCallback, PluginRegistry.Registrar, PluginRegistry.RequestPermissionsResultListener, PluginRegistry.UserLeaveHintListener, PluginRegistry.ViewDestroyListener
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 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.Provider
null
.getFlutterView
in interface FlutterView.Provider
public boolean hasPlugin(String key)
PluginRegistry
hasPlugin
in interface PluginRegistry
key
- a unique String identifying the plugin; typically the fully qualified name of
the plugin's main class.public <T> T valuePublishedByPlugin(String pluginKey)
PluginRegistry
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.
valuePublishedByPlugin
in interface PluginRegistry
pluginKey
- a unique String identifying the plugin; typically the fully qualified name of
the plugin's main class.public PluginRegistry.Registrar registrarFor(String pluginKey)
PluginRegistry
PluginRegistry.Registrar
for receiving the registrations pertaining to the specified plugin.registrarFor
in interface PluginRegistry
pluginKey
- a unique String identifying the plugin; typically the fully qualified name of
the plugin's main class.public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
onRequestPermissionsResult
in interface PluginRegistry.RequestPermissionsResultListener
public boolean onActivityResult(int requestCode, int resultCode, Intent data)
onActivityResult
in interface PluginRegistry.ActivityResultListener
public void onCreate(Bundle savedInstanceState)
onCreate
in interface FlutterActivityEvents
Activity.onCreate(android.os.Bundle)
public void onNewIntent(Intent intent)
onNewIntent
in interface FlutterActivityEvents
Activity.onNewIntent(Intent)
public void onPause()
onPause
in interface FlutterActivityEvents
Activity.onPause()
public void onStart()
onStart
in interface FlutterActivityEvents
Activity.onStart()
public void onResume()
onResume
in interface FlutterActivityEvents
Activity.onResume()
public void onStop()
onStop
in interface FlutterActivityEvents
Activity.onStop()
public void onPostResume()
onPostResume
in interface FlutterActivityEvents
Activity.onPostResume()
public void onDestroy()
onDestroy
in interface FlutterActivityEvents
Activity.onDestroy()
public boolean onBackPressed()
FlutterActivityEvents
onBackPressed
in interface FlutterActivityEvents
true
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 FlutterActivityEvents
Activity.onUserLeaveHint()
public void onTrimMemory(int level)
onTrimMemory
in interface ComponentCallbacks2
public void onLowMemory()
onLowMemory
in interface ComponentCallbacks
public void onConfigurationChanged(Configuration newConfig)
onConfigurationChanged
in interface ComponentCallbacks