# WebViewStartUpConfig.Builder

Artifact: [androidx.webkit:webkit](https://developer.android.com/jetpack/androidx/releases/webkit) [View Source](https://cs.android.com/search?q=file:androidx/webkit/WebViewStartUpConfig.java+class:androidx.webkit.WebViewStartUpConfig.Builder) Added in [1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)

*** ** * ** ***


```
public final class WebViewStartUpConfig.Builder
```

<br />

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig.Builder#Builder(java.util.concurrent.Executor)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor)` Builder for `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig`. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig` | `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig.Builder#build()()` Build and return a `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig` object. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig.Builder` | `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig.Builder#setProfilesToLoadDuringStartup(java.util.Set<java.lang.String>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/String.html> profiles)` Specifies a set of `https://developer.android.com/reference/androidx/webkit/Profile` names to load before the startup callback is invoked. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig.Builder` | `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig.Builder#setShouldRunUiThreadStartUpTasks(boolean)( boolean shouldRunUiThreadStartUpTasks )` Setter to run only parts of startup that doesn't block the UI thread. |

## Public constructors

### Builder

Added in [1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)

```
public Builder(@NonNull Executor executor)
```

Builder for `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor` | The portions of WebView startup that can run on a background thread are scheduled on this executor. Blocking tasks will be run on the executor. Note that this executor is not used to invoke the startup completion callback; to specify an executor for the callback, use `https://developer.android.com/reference/androidx/webkit/WebViewCompat#startUpWebView(android.content.Context,androidx.webkit.WebViewStartUpConfig,java.util.concurrent.Executor,androidx.webkit.WebViewOutcomeReceiver<androidx.webkit.WebViewStartUpResult,androidx.webkit.WebViewStartupException>)`. |

## Public methods

### build

Added in [1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)

```
public @NonNull WebViewStartUpConfig build()
```

Build and return a `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig` object.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig` | immutable `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig` object. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if incompatible options are requested. |

### setProfilesToLoadDuringStartup

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

```
public @NonNull WebViewStartUpConfig.Builder setProfilesToLoadDuringStartup(@NonNull Set<String> profiles)
```

Specifies a set of `https://developer.android.com/reference/androidx/webkit/Profile` names to load before the startup callback is invoked.

This method allows you to specify a set of profiles that are guaranteed to have been loaded before the `https://developer.android.com/reference/androidx/webkit/WebViewCompat.WebViewStartUpCallback` is invoked. This can improve the performance of subsequent operations on those profiles at the cost of increasing the initial startup time.

Any profiles not specified in the set will not have resources allocated for them until they are used for the first time.

The behavior depends on the value provided:

- **Empty Set:** No profiles are loaded, not even the default profile.
- **Non-empty Set:** All profiles named in the set are loaded. These profiles will be created if they do not already exist.

If this method isn't called, the default profile will be loaded during startup.

**Note:** This method cannot be used if `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig.Builder#setShouldRunUiThreadStartUpTasks(boolean)` is set to `false`.

This method will be no-op if `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isStartupFeatureSupported(android.content.Context,java.lang.String)` returns false for `https://developer.android.com/reference/androidx/webkit/WebViewFeature#STARTUP_FEATURE_SET_PROFILES_TO_LOAD()`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/String.html> profiles` | A `https://developer.android.com/reference/java/util/Set.html` of `https://developer.android.com/reference/androidx/webkit/Profile` names to preload or an empty Set to load none. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig.Builder` | The `https://developer.android.com/reference/androidx/webkit/WebViewStartUpConfig.Builder` instance for method chaining. |

### setShouldRunUiThreadStartUpTasks

Added in [1.13.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.13.0)

```
public @NonNull WebViewStartUpConfig.Builder setShouldRunUiThreadStartUpTasks(
    boolean shouldRunUiThreadStartUpTasks
)
```

Setter to run only parts of startup that doesn't block the UI thread.

WebView startup tasks that are required to run on the UI thread are not attempted when `https://developer.android.com/reference/androidx/webkit/WebViewCompat#startUpWebView(android.content.Context,androidx.webkit.WebViewStartUpConfig,androidx.webkit.WebViewOutcomeReceiver<androidx.webkit.WebViewStartUpResult,androidx.webkit.WebViewStartupException>)` is called if set to `false`.

Defaults to \`true\`. If not set to \`false\`, UI thread startup tasks will be run.