Print the contents of a Bundle to Logcat?

后端 未结 10 677
孤独总比滥情好
孤独总比滥情好 2020-12-24 04:47

Is there an easy way to print the contents of a Bundle to Logcat if you can\'t remember the names of all the keys (even being able to print just the key names w

10条回答
  •  忘掉有多难
    2020-12-24 05:13

    Simple Bundle to String implementation in Kotlin:

    val bundleToString = bundle.keySet()
                .joinToString(", ", "{", "}") { key ->
                    "$key=${bundle[key]}"
                }
    

    Example of result {id=3, name="Jhon"}

提交回复
热议问题