Stay organized with collections
Save and categorize content based on your preferences.
WebBackForwardList
abstract class WebBackForwardList : Cloneable, Serializable
This class contains the back/forward list for a WebView. WebView.copyBackForwardList() will return a copy of this class used to inspect the entries in the list.
Summary
Public methods |
abstract Int |
Get the index of the current history item.
|
abstract WebHistoryItem? |
Return the current history item.
|
abstract WebHistoryItem! |
Get the history item at the given index.
|
abstract Int |
Get the total size of the back/forward list.
|
Protected methods |
abstract WebBackForwardList |
Clone the entire object to be used in the UI thread by clients of WebView.
|
Public constructors
WebBackForwardList
WebBackForwardList()
Public methods
getCurrentIndex
abstract fun getCurrentIndex(): Int
Get the index of the current history item. This index can be used to directly index into the array list.
Return |
Int |
The current index from 0...n or -1 if the list is empty. |
getCurrentItem
abstract fun getCurrentItem(): WebHistoryItem?
Return the current history item. This method returns null
if the list is empty.
getItemAtIndex
abstract fun getItemAtIndex(index: Int): WebHistoryItem!
Get the history item at the given index. The index range is from 0...n where 0 is the first item and n is the last item.
Parameters |
index |
Int: The index to retrieve. |
getSize
abstract fun getSize(): Int
Get the total size of the back/forward list.
Return |
Int |
The size of the list. |
Protected methods
clone
protected abstract fun clone(): WebBackForwardList
Clone the entire object to be used in the UI thread by clients of WebView. This creates a copy that should never be modified by any of the webkit package classes. On Android 4.4 and later there is no need to use this, as the object is already a read-only copy of the internal state.
Exceptions |
java.lang.CloneNotSupportedException |
if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# WebBackForwardList\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nWebBackForwardList\n==================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/webkit/WebBackForwardList \"View this page in Java\") \n\n```\nabstract class WebBackForwardList : Cloneable, Serializable\n```\n\n|---|----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.webkit.WebBackForwardList](#) |\n\nThis class contains the back/forward list for a WebView. WebView.copyBackForwardList() will return a copy of this class used to inspect the entries in the list.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------|---|\n| [WebBackForwardList](#WebBackForwardList())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getCurrentIndex](#getCurrentIndex())`()` Get the index of the current history item. |\n| abstract [WebHistoryItem](/reference/kotlin/android/webkit/WebHistoryItem)? | [getCurrentItem](#getCurrentItem())`()` Return the current history item. |\n| abstract [WebHistoryItem](/reference/kotlin/android/webkit/WebHistoryItem)! | [getItemAtIndex](#getItemAtIndex(kotlin.Int))`(`index:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Get the history item at the given index. |\n| abstract [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getSize](#getSize())`()` Get the total size of the back/forward list. |\n\n| Protected methods ||\n|----------------------------------|--------------------------------------------------------------------------------------------------|\n| abstract [WebBackForwardList](#) | [clone](#clone())`()` Clone the entire object to be used in the UI thread by clients of WebView. |\n\nPublic constructors\n-------------------\n\n### WebBackForwardList\n\n```\nWebBackForwardList()\n```\n\nPublic methods\n--------------\n\n### getCurrentIndex\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getCurrentIndex(): Int\n```\n\nGet the index of the current history item. This index can be used to directly index into the array list.\n\n| Return ||\n|----------------------------------------------------------------------------|----------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The current index from 0...n or -1 if the list is empty. |\n\n### getCurrentItem\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getCurrentItem(): WebHistoryItem?\n```\n\nReturn the current history item. This method returns `null` if the list is empty.\n\n| Return ||\n|--------------------------------------------------------------------|---------------------------|\n| [WebHistoryItem](/reference/kotlin/android/webkit/WebHistoryItem)? | The current history item. |\n\n### getItemAtIndex\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getItemAtIndex(index: Int): WebHistoryItem!\n```\n\nGet the history item at the given index. The index range is from 0...n where 0 is the first item and n is the last item.\n\n| Parameters ||\n|---------|----------------------------------------------------------------------------------------------------|\n| `index` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The index to retrieve. |\n\n### getSize\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getSize(): Int\n```\n\nGet the total size of the back/forward list.\n\n| Return ||\n|----------------------------------------------------------------------------|-----------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The size of the list. |\n\nProtected methods\n-----------------\n\n### clone\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected abstract fun clone(): WebBackForwardList\n```\n\nClone the entire object to be used in the UI thread by clients of WebView. This creates a copy that should never be modified by any of the webkit package classes. On Android 4.4 and later there is no need to use this, as the object is already a read-only copy of the internal state.\n\n| Return ||\n|-------------------------|---------------------------|\n| [WebBackForwardList](#) | a clone of this instance. |\n\n| Exceptions ||\n|----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `java.lang.CloneNotSupportedException` | if the object's class does not support the `Cloneable` interface. Subclasses that override the `clone` method can also throw this exception to indicate that an instance cannot be cloned. |"]]