NavigationParameters.Builder


class NavigationParameters.Builder


A Builder for NavigationParameters.

Summary

Public constructors

Constructor for NavigationParameters builder which sets parameter defaults.

Public functions

NavigationParameters.Builder

Adds an additional HTTP header to the request.

NavigationParameters.Builder
addAdditionalHeaders(additionalHeaders: (Mutable)Map<String!, String!>)

Adds multiple additional HTTP headers to the request, as if addAdditionalHeader were called multiple times with each key-value pair of the map.

NavigationParameters
@RequiresFeature(name = WebViewFeature.WEBVIEW_NAVIGATE_EXPERIMENTAL_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
build()

Use to finish building the NavigationParameters.

NavigationParameters.Builder
setShouldReplaceCurrentEntry(shouldReplaceCurrentEntry: Boolean)

If true, the navigation will replace the current entry in the WebView's history, meaning that the current entry will not be reachable through WebView#goBack.

Public constructors

Builder

Builder()

Constructor for NavigationParameters builder which sets parameter defaults.

Public functions

addAdditionalHeader

fun addAdditionalHeader(key: String, value: String): NavigationParameters.Builder

Adds an additional HTTP header to the request. Note that if the header is set by default by this WebView, such as those controlling caching, accept types or the User-Agent, it may be overridden by this WebView's default.

Unlike headers passed to loadUrl, additional headers passed here are tied to the navigation, meaning that subsequent user triggered navigations to the same URL will not have those headers applied. If called multiple times for the same key, the latest value will be used.

Header keys must be RFC 2616-compliant.

addAdditionalHeaders

fun addAdditionalHeaders(additionalHeaders: (Mutable)Map<String!, String!>): NavigationParameters.Builder

Adds multiple additional HTTP headers to the request, as if addAdditionalHeader were called multiple times with each key-value pair of the map. See addAdditionalHeader for more information.

build

@RequiresFeature(name = WebViewFeature.WEBVIEW_NAVIGATE_EXPERIMENTAL_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun build(): NavigationParameters

Use to finish building the NavigationParameters.

This method should only be called if isFeatureSupported returns true for WEBVIEW_NAVIGATE_EXPERIMENTAL_V1.

Returns
NavigationParameters

built NavigationParameters object.

setShouldReplaceCurrentEntry

fun setShouldReplaceCurrentEntry(shouldReplaceCurrentEntry: Boolean): NavigationParameters.Builder

If true, the navigation will replace the current entry in the WebView's history, meaning that the current entry will not be reachable through WebView#goBack. Defaults to false.