Package io.flutter.embedding.android

## Class FlutterActivity.NewEngineInGroupIntentBuilder

- java.lang.Object
- - io.flutter.embedding.android.FlutterActivity.NewEngineInGroupIntentBuilder

- Enclosing class:
    FlutterActivity

      public static class FlutterActivity.NewEngineInGroupIntentBuilder
      extends Object

  Builder to create an `Intent` that launches a `FlutterActivity` with a new `FlutterEngine` created by FlutterEngineGroup#createAndRunEngine.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `NewEngineInGroupIntentBuilder​(Class<? extends FlutterActivity> activityClass, String engineGroupId)` | Constructor that allows this `NewEngineInGroupIntentBuilder` to be used by subclasses of `FlutterActivity`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `FlutterActivity.NewEngineInGroupIntentBuilder` | `backgroundMode​(FlutterActivityLaunchConfigs.BackgroundMode backgroundMode)` | The mode of `FlutterActivity`'s background, either `FlutterActivityLaunchConfigs.BackgroundMode.opaque` or `FlutterActivityLaunchConfigs.BackgroundMode.transparent`.
    `Intent` | `build​(Context context)` | Creates and returns an `Intent` that will launch a `FlutterActivity` with the desired configuration.
    `FlutterActivity.NewEngineInGroupIntentBuilder` | `dartEntrypoint​(String dartEntrypoint)` | The Dart entrypoint that will be executed in the newly created FlutterEngine as soon as the Dart snapshot is loaded.
    `FlutterActivity.NewEngineInGroupIntentBuilder` | `initialRoute​(String initialRoute)` | The initial route that a Flutter app will render in this `FlutterActivity`, defaults to "/".

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NewEngineInGroupIntentBuilder

          public NewEngineInGroupIntentBuilder​(@NonNull
                                               Class<? extends FlutterActivity> activityClass,
                                               @NonNull
                                               String engineGroupId)

      Constructor that allows this `NewEngineInGroupIntentBuilder` to be used by subclasses of `FlutterActivity`.

      Subclasses of `FlutterActivity` should provide their own static version of `FlutterActivity.withNewEngineInGroup(java.lang.String)`, which returns an instance of `NewEngineInGroupIntentBuilder` constructed with a `Class` reference to the `FlutterActivity` subclass, e.g.:

      `return new NewEngineInGroupIntentBuilder(MyFlutterActivity.class, cacheedEngineGroupId);`

           // Create a FlutterEngineGroup, such as in the onCreate method of the Application.
           FlutterEngineGroup engineGroup = new FlutterEngineGroup(this);
           FlutterEngineGroupCache.getInstance().put("my_cached_engine_group_id", engineGroup);

           // Create a NewEngineInGroupIntentBuilder that would build an intent to start my custom FlutterActivity subclass.
           FlutterActivity.NewEngineInGroupIntentBuilder intentBuilder =
               new FlutterActivity.NewEngineInGroupIntentBuilder(
                     MyFlutterActivity.class,
                     app.engineGroupId);
           intentBuilder.dartEntrypoint("main")
               .initialRoute("/custom/route")
               .backgroundMode(BackgroundMode.transparent);
           startActivity(intentBuilder.build(context));

      Parameters:
        `activityClass` - A subclass of `FlutterActivity`.
        `engineGroupId` - The engine group id.

  - ### Method Detail

    - #### dartEntrypoint

          @NonNull
          public FlutterActivity.NewEngineInGroupIntentBuilder dartEntrypoint​(@NonNull
                                                                              String dartEntrypoint)

      The Dart entrypoint that will be executed in the newly created FlutterEngine as soon as the Dart snapshot is loaded. Default to "main".
      Parameters:
        `dartEntrypoint` - The dart entrypoint's name
      Returns:
        The engine group intent builder

    - #### initialRoute

          @NonNull
          public FlutterActivity.NewEngineInGroupIntentBuilder initialRoute​(@NonNull
                                                                            String initialRoute)

      The initial route that a Flutter app will render in this `FlutterActivity`, defaults to "/".
      Parameters:
        `initialRoute` - The route.
      Returns:
        The engine group intent builder.

    - #### backgroundMode

          @NonNull
          public FlutterActivity.NewEngineInGroupIntentBuilder backgroundMode​(@NonNull
                                                                              FlutterActivityLaunchConfigs.BackgroundMode backgroundMode)

      The mode of `FlutterActivity`'s background, either `FlutterActivityLaunchConfigs.BackgroundMode.opaque` or `FlutterActivityLaunchConfigs.BackgroundMode.transparent`.

      The default background mode is `FlutterActivityLaunchConfigs.BackgroundMode.opaque`.

      Choosing a background mode of `FlutterActivityLaunchConfigs.BackgroundMode.transparent` will configure the inner `FlutterView` of this `FlutterActivity` to be configured with a `FlutterTextureView` to support transparency. This choice has a non-trivial performance impact. A transparent background should only be used if it is necessary for the app design being implemented.

      A `FlutterActivity` that is configured with a background mode of `FlutterActivityLaunchConfigs.BackgroundMode.transparent` must have a theme applied to it that includes the following property: `<item name="android:windowIsTranslucent">true</item>`.

      Parameters:
        `backgroundMode` - The background mode.
      Returns:
        The engine group intent builder.

    - #### build

          @NonNull
          public Intent build​(@NonNull
                              Context context)

      Creates and returns an `Intent` that will launch a `FlutterActivity` with the desired configuration.
      Parameters:
        `context` - The context. e.g. An Activity.
      Returns:
        The intent.