Created
October 13, 2022 00:40
-
-
Save BeokBeok/e7b58fe3b208098e49bdddc422789ed0 to your computer and use it in GitHub Desktop.
Debugging Android Intents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Intent?.toDebugString(): String { | |
val intent = this ?: return "" | |
return StringBuilder().apply { | |
appendLine("--- Intent ---") | |
appendLine("type: ${intent.type}") | |
appendLine("package: ${intent.`package`}") | |
appendLine("scheme: ${intent.scheme}") | |
appendLine("component: ${intent.component}") | |
appendLine("flags: ${intent.flags}") | |
appendLine("categories: ${intent.categories}") | |
appendLine("selector: ${intent.selector}") | |
appendLine("action: ${intent.action}") | |
appendLine("dataString: ${intent.dataString}") | |
intent.extras?.keySet()?.forEach { key -> | |
appendLine("* extra: $key=${intent.extras!![key]}") | |
} | |
}.toString() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment