Skip to content

Instantly share code, notes, and snippets.

View ericharlow's full-sized avatar

Eric Harlow ericharlow

View GitHub Profile
@ericharlow
ericharlow / BundleExt.kt
Last active June 15, 2018 15:29
Makes a printable string of the contents of a Bundle
fun Bundle.toContentString(): String {
val builder = StringBuilder("Extras:\n")
for (key in keySet()) {
val value = get(key)
builder.append(key).append(": ").append(value).append("\n")
}
return builder.toString()
}
@ericharlow
ericharlow / SerializationUtil.kt
Last active June 15, 2018 15:30
Serializable to string and back
import java.io.*
/**
* Returns an empty string if something goes wrong internally
*/
fun serializableToString(item : Serializable) : String {
var result = ""
try {
val stream = ByteArrayOutputStream()