Skip to content

Instantly share code, notes, and snippets.

@rommansabbir
Created October 10, 2022 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rommansabbir/273ee3055a89b35d749b03f739fb4696 to your computer and use it in GitHub Desktop.
Save rommansabbir/273ee3055a89b35d749b03f739fb4696 to your computer and use it in GitHub Desktop.
Intent Debug Ext
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