Stay organized with collections
Save and categorize content based on your preferences.
Callback
interface Callback<T : Any!>
Base interface for answer callbacks
Summary
Public methods |
abstract Unit |
Success response to android.
|
abstract Unit |
Error response to android.
|
Public methods
onAnswer
abstract fun onAnswer(
answer: T,
rcode: Int
): Unit
Success response to android.net.DnsResolver#query or android.net.DnsResolver#rawQuery. Invoked when the answer to a query was successfully parsed.
Parameters |
answer |
T: answer to the query. This value cannot be null . |
rcode |
Int: The response code in the DNS response. |
onError
abstract fun onError(error: DnsResolver.DnsException): Unit
Error response to android.net.DnsResolver#query or android.net.DnsResolver#rawQuery. Invoked when there is no valid answer to android.net.DnsResolver#query android.net.DnsResolver#rawQuery.
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,["# DnsResolver.Callback\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nCallback\n========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/DnsResolver.Callback \"View this page in Java\") \n\n```\ninterface Callback\u003cT : Any!\u003e\n```\n\n|---------------------------------------|\n| [android.net.DnsResolver.Callback](#) |\n\nBase interface for answer callbacks\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAnswer](#onAnswer(android.net.DnsResolver.Callback.T,%20kotlin.Int))`(`answer:` `T`, `rcode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Success response to android. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onError](#onError(android.net.DnsResolver.DnsException))`(`error:` `[DnsResolver.DnsException](/reference/kotlin/android/net/DnsResolver.DnsException)`)` Error response to android. |\n\nPublic methods\n--------------\n\n### onAnswer\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onAnswer(\n answer: T, \n rcode: Int\n): Unit\n```\n\nSuccess response to android.net.DnsResolver#query or android.net.DnsResolver#rawQuery. Invoked when the answer to a query was successfully parsed.\n\n| Parameters ||\n|----------|--------------------------------------------------------------------------------------------------------------------|\n| `answer` | T: answer to the query. This value cannot be `null`. |\n| `rcode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The response code in the DNS response. |\n\n**See Also**\n\n### onError\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onError(error: DnsResolver.DnsException): Unit\n```\n\nError response to android.net.DnsResolver#query or android.net.DnsResolver#rawQuery. Invoked when there is no valid answer to android.net.DnsResolver#query android.net.DnsResolver#rawQuery.\n\n| Parameters ||\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `error` | [DnsResolver.DnsException](/reference/kotlin/android/net/DnsResolver.DnsException): a [DnsException](/reference/kotlin/android/net/DnsResolver.DnsException) object with additional detail regarding the failure This value cannot be `null`. |"]]