# 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)

*** ** * ** ***


```
class WebViewStartUpConfig.Builder
```

<br />

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig.Builder#Builder(java.util.concurrent.Executor)(executor: https://developer.android.com/reference/java/util/concurrent/Executor.html)` Builder for `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig.Builder#build()()` Build and return a `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig` object. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig.Builder` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig.Builder#setProfilesToLoadDuringStartup(java.util.Set<java.lang.String>)(profiles: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>)` Specifies a set of `https://developer.android.com/reference/kotlin/androidx/webkit/Profile` names to load before the startup callback is invoked. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig.Builder` | `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig.Builder#setShouldRunUiThreadStartUpTasks(boolean)( shouldRunUiThreadStartUpTasks: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` 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)

```
Builder(executor: Executor)
```

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

| Parameters |
|---|---|
| `executor: https://developer.android.com/reference/java/util/concurrent/Executor.html` | 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/kotlin/androidx/webkit/WebViewCompat#startUpWebView(android.content.Context,androidx.webkit.WebViewStartUpConfig,java.util.concurrent.Executor,androidx.webkit.WebViewOutcomeReceiver<androidx.webkit.WebViewStartUpResult,androidx.webkit.WebViewStartupException>)`. |

## Public functions

### build

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

```
fun build(): WebViewStartUpConfig
```

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

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig` | immutable `https://developer.android.com/reference/kotlin/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)

```
fun setProfilesToLoadDuringStartup(profiles: (Mutable)Set<String!>): WebViewStartUpConfig.Builder
```

Specifies a set of `https://developer.android.com/reference/kotlin/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/kotlin/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/kotlin/androidx/webkit/WebViewStartUpConfig.Builder#setShouldRunUiThreadStartUpTasks(boolean)` is set to `false`.

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

| Parameters |
|---|---|
| `profiles: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | A `https://developer.android.com/reference/java/util/Set.html` of `https://developer.android.com/reference/kotlin/androidx/webkit/Profile` names to preload or an empty Set to load none. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewStartUpConfig.Builder` | The `https://developer.android.com/reference/kotlin/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)

```
fun setShouldRunUiThreadStartUpTasks(
    shouldRunUiThreadStartUpTasks: Boolean
): WebViewStartUpConfig.Builder
```

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/kotlin/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.